Skip to content

feat: add load_view to REST catalog#3224

Open
spr0els wants to merge 3 commits intoapache:mainfrom
spr0els:load_view
Open

feat: add load_view to REST catalog#3224
spr0els wants to merge 3 commits intoapache:mainfrom
spr0els:load_view

Conversation

@spr0els
Copy link
Copy Markdown

@spr0els spr0els commented Apr 9, 2026

Rationale for this change

This is part of #818 and implements the load_view method for REST catalogs.

Are these changes tested?

Unit tests are added for:

  • successful loading of a view
  • thrown 404 error when trying to load a non existing view

Are there any user-facing changes?

This adds the load_view method for REST catalogs

Comment thread pyiceberg/catalog/__init__.py Outdated
Comment on lines +651 to +652
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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I would say we remove these.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the docstring

assert actual == expected


def test_load_view_404(rest_mock: Mocker) -> None:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I'm wrong, but isn't this case already covered with the test_load_view_404 test?
If no view with the same identifier as the table identifier is found in the warehouse, this would be the same case as loading a non existent view.

Comment thread pyiceberg/catalog/__init__.py Outdated
Comment on lines +651 to +652
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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread pyiceberg/catalog/rest/__init__.py Outdated
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={},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitty: we don't need to pass in the empty params

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the empty params

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants