gabeiglio commented on code in PR #3224:
URL: https://github.com/apache/iceberg-python/pull/3224#discussion_r3067919322


##########
tests/catalog/test_rest.py:
##########
@@ -1416,6 +1417,38 @@ def test_create_view_409(
     assert "View already exists" in str(e.value)
 
 
+def test_load_view_200(rest_mock: Mocker, example_view_metadata_rest_json: 
dict[str, Any]) -> None:
+    rest_mock.get(
+        f"{TEST_URI}v1/namespaces/fokko/views/view",
+        json=example_view_metadata_rest_json,
+        status_code=200,
+        request_headers=TEST_HEADERS,
+    )
+    catalog = RestCatalog("rest", uri=TEST_URI, token=TEST_TOKEN)
+    actual = catalog.load_view(("fokko", "view"))
+    expected = View(identifier=("fokko", "view"), 
metadata=ViewMetadata(**example_view_metadata_rest_json["metadata"]))
+    assert actual == expected
+
+
+def test_load_view_404(rest_mock: Mocker) -> None:

Review Comment:
   Would also add a test that should return a view does not exists when trying 
to load a table with loadView



##########
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:
   Nit: I would say we remove these.



-- 
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]

Reply via email to