nhuantho commented on code in PR #2149:
URL: https://github.com/apache/iceberg-python/pull/2149#discussion_r3659910924
##########
pyiceberg/catalog/rest/__init__.py:
##########
@@ -1503,6 +1506,29 @@ def drop_view(self, identifier: str | Identifier) ->
None:
except HTTPError as exc:
_handle_non_200_response(exc, {404: NoSuchViewError})
+ @retry(**_RETRY_ARGS)
+ def rename_view(self, from_identifier: str | Identifier, to_identifier:
str | Identifier) -> None:
+ self._check_endpoint(Capability.V1_RENAME_VIEW)
+ payload = {
Review Comment:
self._split_identifier_for_json is still called twice per namespace.
I think we can move the payload after checking namespace_exists, for example
```
source = self._split_identifier_for_json(from_identifier)
destination = self._split_identifier_for_json(to_identifier)
# Ensure that namespaces exist on source and destination.
source_namespace = source["namespace"]
if not self.namespace_exists(source_namespace):
raise NoSuchNamespaceError(f"Source namespace does not exist:
{source_namespace}")
destination_namespace = destination["namespace"]
if not self.namespace_exists(destination_namespace):
raise NoSuchNamespaceError(f"Destination namespace does not
exist: {destination_namespace}")
payload = {
"source": source,
"destination": destination,
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]