You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "ebyhr (via GitHub)" <gi...@apache.org> on 2026/05/05 00:51:49 UTC
Re: [PR] feat: add load_view to REST catalog [iceberg-python]
ebyhr commented on code in PR #3224:
URL: https://github.com/apache/iceberg-python/pull/3224#discussion_r3185347605
##########
tests/integration/test_rest_catalog.py:
##########
@@ -62,3 +67,47 @@ def test_create_namespace_if_already_existing(catalog: RestCatalog) -> None:
catalog.create_namespace_if_not_exists(TEST_NAMESPACE_IDENTIFIER)
assert catalog.namespace_exists(TEST_NAMESPACE_IDENTIFIER)
+
+
+@pytest.mark.integration
+@pytest.mark.parametrize("catalog", [lf("session_catalog")])
+def test_load_view(catalog: RestCatalog, table_schema_nested: Schema, database_name: str, view_name: str) -> None:
+ identifier = (database_name, view_name)
+ if not catalog.namespace_exists(database_name):
+ catalog.create_namespace(database_name)
+
+ view_version = ViewVersion(
+ version_id=1,
+ schema_id=1,
+ timestamp_ms=int(time.time() * 1000),
+ summary={},
+ representations=[
+ SQLViewRepresentation(
+ type="sql",
+ sql="SELECT 1 as some_col",
+ dialect="spark",
+ )
+ ],
+ default_namespace=["default"],
+ )
+ view = catalog.create_view(identifier, table_schema_nested, view_version=view_version)
+ loaded_view = catalog.load_view(identifier)
+ assert view.name() == loaded_view.name()
+ assert view.metadata == loaded_view.metadata
Review Comment:
We could verify the entire object instead:
```suggestion
assert view == loaded_view
```
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org