Skip to content

Commit af2746f

Browse files
committed
REST: Add missing endpoint check for creating views
1 parent 5da8186 commit af2746f

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
@@ -185,6 +185,7 @@ class Capability:
185185
V1_LIST_VIEWS = Endpoint(http_method=HttpMethod.GET, path=f"{API_PREFIX}/{Endpoints.list_views}")
186186
V1_LOAD_VIEW = Endpoint(http_method=HttpMethod.GET, path=f"{API_PREFIX}/{Endpoints.load_view}")
187187
V1_VIEW_EXISTS = Endpoint(http_method=HttpMethod.HEAD, path=f"{API_PREFIX}/{Endpoints.view_exists}")
188+
V1_CREATE_VIEW = Endpoint(http_method=HttpMethod.POST, path=f"{API_PREFIX}/{Endpoints.create_view}")
188189
V1_REGISTER_VIEW = Endpoint(http_method=HttpMethod.POST, path=f"{API_PREFIX}/{Endpoints.register_view}")
189190
V1_DELETE_VIEW = Endpoint(http_method=HttpMethod.DELETE, path=f"{API_PREFIX}/{Endpoints.drop_view}")
190191
V1_SUBMIT_TABLE_SCAN_PLAN = Endpoint(http_method=HttpMethod.POST, path=f"{API_PREFIX}/{Endpoints.plan_table_scan}")
@@ -215,6 +216,7 @@ class Capability:
215216
(
216217
Capability.V1_LIST_VIEWS,
217218
Capability.V1_LOAD_VIEW,
219+
Capability.V1_CREATE_VIEW,
218220
Capability.V1_DELETE_VIEW,
219221
)
220222
)
@@ -971,6 +973,7 @@ def create_view(
971973
location: str | None = None,
972974
properties: Properties = EMPTY_DICT,
973975
) -> View:
976+
self._check_endpoint(Capability.V1_CREATE_VIEW)
974977
iceberg_schema = self._convert_schema_if_needed(schema)
975978
fresh_schema = assign_fresh_schema_ids(iceberg_schema)
976979

tests/catalog/test_rest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
Capability.V1_LIST_VIEWS,
108108
Capability.V1_LOAD_VIEW,
109109
Capability.V1_VIEW_EXISTS,
110+
Capability.V1_CREATE_VIEW,
110111
Capability.V1_REGISTER_VIEW,
111112
Capability.V1_DELETE_VIEW,
112113
Capability.V1_SUBMIT_TABLE_SCAN_PLAN,

0 commit comments

Comments
 (0)