geruh commented on code in PR #3224:
URL: https://github.com/apache/iceberg-python/pull/3224#discussion_r3083715465
##########
pyiceberg/catalog/__init__.py:
##########
@@ -644,6 +644,23 @@ def list_views(self, namespace: str | Identifier) ->
list[Identifier]:
NoSuchNamespaceError: If a namespace with the given name does not
exist.
"""
+ @abstractmethod
+ def load_view(self, identifier: str | Identifier) -> View:
+ """Load the view's metadata and returns the view instance.
+
+ You can also use this method to check for view existence using 'try
catalog.load_view() except NoSuchViewError'.
+ Note: This method doesn't scan data stored in the view.
Review Comment:
+1 this is simply just load a view it doesn't have to follow the convention
of load_table.
ref:
https://github.com/apache/iceberg/blob/53374bde66955885de6fca0ea59b946346ec2d89/api/src/main/java/org/apache/iceberg/catalog/ViewCatalog.java#L49
##########
pyiceberg/catalog/rest/__init__.py:
##########
@@ -1099,6 +1102,21 @@ def list_views(self, namespace: str | Identifier) ->
list[Identifier]:
_handle_non_200_response(exc, {404: NoSuchNamespaceError})
return [(*view.namespace, view.name) for view in
ListViewsResponse.model_validate_json(response.text).identifiers]
+ @retry(**_RETRY_ARGS)
+ def load_view(self, identifier: str | Identifier) -> View:
+ self._check_endpoint(Capability.V1_LOAD_VIEW)
+ response = self._session.get(
+ self.url(Endpoints.load_view, prefixed=True,
**self._split_identifier_for_path(identifier, IdentifierKind.VIEW)),
+ params={},
Review Comment:
nitty: we don't need to pass in the empty params
--
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]