Skip to content

Commit 5552dbd

Browse files
committed
REST: Add missing endpoint check for creating views
1 parent 5133f35 commit 5552dbd

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

pyiceberg/catalog/rest/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ class Capability:
206206
V1_LIST_VIEWS = Endpoint(http_method=HttpMethod.GET, path=f"{API_PREFIX}/{Endpoints.list_views}")
207207
V1_LOAD_VIEW = Endpoint(http_method=HttpMethod.GET, path=f"{API_PREFIX}/{Endpoints.load_view}")
208208
V1_VIEW_EXISTS = Endpoint(http_method=HttpMethod.HEAD, path=f"{API_PREFIX}/{Endpoints.view_exists}")
209+
V1_CREATE_VIEW = Endpoint(http_method=HttpMethod.POST, path=f"{API_PREFIX}/{Endpoints.create_view}")
209210
V1_REGISTER_VIEW = Endpoint(http_method=HttpMethod.POST, path=f"{API_PREFIX}/{Endpoints.register_view}")
210211
V1_DELETE_VIEW = Endpoint(http_method=HttpMethod.DELETE, path=f"{API_PREFIX}/{Endpoints.drop_view}")
211212
V1_SUBMIT_TABLE_SCAN_PLAN = Endpoint(http_method=HttpMethod.POST, path=f"{API_PREFIX}/{Endpoints.plan_table_scan}")
@@ -243,6 +244,7 @@ class Capability:
243244
(
244245
Capability.V1_LIST_VIEWS,
245246
Capability.V1_LOAD_VIEW,
247+
Capability.V1_CREATE_VIEW,
246248
Capability.V1_DELETE_VIEW,
247249
)
248250
)
@@ -1280,6 +1282,7 @@ def create_view(
12801282
location: str | None = None,
12811283
properties: Properties = EMPTY_DICT,
12821284
) -> View:
1285+
self._check_endpoint(Capability.V1_CREATE_VIEW)
12831286
iceberg_schema = self._convert_schema_if_needed(schema)
12841287
fresh_schema = assign_fresh_schema_ids(iceberg_schema)
12851288

tests/catalog/test_rest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115
Capability.V1_LIST_VIEWS,
116116
Capability.V1_LOAD_VIEW,
117117
Capability.V1_VIEW_EXISTS,
118+
Capability.V1_CREATE_VIEW,
118119
Capability.V1_REGISTER_VIEW,
119120
Capability.V1_DELETE_VIEW,
120121
Capability.V1_SUBMIT_TABLE_SCAN_PLAN,

0 commit comments

Comments
 (0)