You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polaris.apache.org by em...@apache.org on 2025/06/02 23:28:36 UTC

(polaris) branch main updated: Re-add missing parameters to create_table python API (#1778)

This is an automated email from the ASF dual-hosted git repository.

emaynard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git


The following commit(s) were added to refs/heads/main by this push:
     new 8f906a6c0 Re-add missing parameters to create_table python API (#1778)
8f906a6c0 is described below

commit 8f906a6c00b6cbfd18d5e944359645ff974bddba
Author: Eric Maynard <er...@snowflake.com>
AuthorDate: Mon Jun 2 16:28:33 2025 -0700

    Re-add missing parameters to create_table python API (#1778)
    
    It looks like this method lost the `prefix` and `namespace` parameters in #1347. They're re-introduced to the spec here, and then I've run:
    ```
    redocly bundle spec/polaris-catalog-service.yaml -o spec/generated/bundled-polaris-catalog-service.yaml
    ./gradlew regeneratePythonClient
    ```
    
    Then, some manual reverts:
    ```
    alias gitrevert='git checkout upstream/main --'
    gitrevert client/python/.github/workflows/python.yml
    gitrevert client/python/.gitlab-ci.yml
    gitrevert client/python/pyproject.toml
    ```
    
    I still hope to automate this process as part of CI soon; see #1675
---
 client/python/docs/IcebergCatalogAPI.md            |  8 ++++--
 .../polaris/catalog/api/iceberg_catalog_api.py     | 30 ++++++++++++++++++++++
 .../generated/bundled-polaris-catalog-service.yaml |  2 ++
 spec/iceberg-rest-catalog-open-api.yaml            |  2 ++
 4 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/client/python/docs/IcebergCatalogAPI.md b/client/python/docs/IcebergCatalogAPI.md
index e872a5dd1..4957c23e5 100644
--- a/client/python/docs/IcebergCatalogAPI.md
+++ b/client/python/docs/IcebergCatalogAPI.md
@@ -328,7 +328,7 @@ Name | Type | Description  | Notes
 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
 
 # **create_table**
-> LoadTableResult create_table(create_table_request, x_iceberg_access_delegation=x_iceberg_access_delegation)
+> LoadTableResult create_table(prefix, namespace, create_table_request, x_iceberg_access_delegation=x_iceberg_access_delegation)
 
 Create a table in the given namespace
 
@@ -368,12 +368,14 @@ configuration = polaris.catalog.Configuration(
 with polaris.catalog.ApiClient(configuration) as api_client:
     # Create an instance of the API class
     api_instance = polaris.catalog.IcebergCatalogAPI(api_client)
+    prefix = 'prefix_example' # str | An optional prefix in the path
+    namespace = 'accounting' # str | A namespace identifier as a single string. Multipart namespace parts should be separated by the unit separator (`0x1F`) byte.
     create_table_request = polaris.catalog.CreateTableRequest() # CreateTableRequest | 
     x_iceberg_access_delegation = 'vended-credentials,remote-signing' # str | Optional signal to the server that the client supports delegated access via a comma-separated list of access mechanisms.  The server may choose to supply access via any or none of the requested mechanisms.  Specific properties and handling for `vended-credentials` is documented in the `LoadTableResult` schema section of this spec document.  The protocol and specification for `remote-signing` is documented in  t [...]
 
     try:
         # Create a table in the given namespace
-        api_response = api_instance.create_table(create_table_request, x_iceberg_access_delegation=x_iceberg_access_delegation)
+        api_response = api_instance.create_table(prefix, namespace, create_table_request, x_iceberg_access_delegation=x_iceberg_access_delegation)
         print("The response of IcebergCatalogAPI->create_table:\n")
         pprint(api_response)
     except Exception as e:
@@ -387,6 +389,8 @@ with polaris.catalog.ApiClient(configuration) as api_client:
 
 Name | Type | Description  | Notes
 ------------- | ------------- | ------------- | -------------
+ **prefix** | **str**| An optional prefix in the path | 
+ **namespace** | **str**| A namespace identifier as a single string. Multipart namespace parts should be separated by the unit separator (&#x60;0x1F&#x60;) byte. | 
  **create_table_request** | [**CreateTableRequest**](CreateTableRequest.md)|  | 
  **x_iceberg_access_delegation** | **str**| Optional signal to the server that the client supports delegated access via a comma-separated list of access mechanisms.  The server may choose to supply access via any or none of the requested mechanisms.  Specific properties and handling for &#x60;vended-credentials&#x60; is documented in the &#x60;LoadTableResult&#x60; schema section of this spec document.  The protocol and specification for &#x60;remote-signing&#x60; is documented in  the & [...]
 
diff --git a/client/python/polaris/catalog/api/iceberg_catalog_api.py b/client/python/polaris/catalog/api/iceberg_catalog_api.py
index a9e17e1c1..e5327a298 100644
--- a/client/python/polaris/catalog/api/iceberg_catalog_api.py
+++ b/client/python/polaris/catalog/api/iceberg_catalog_api.py
@@ -1040,6 +1040,8 @@ class IcebergCatalogAPI:
     @validate_call
     def create_table(
         self,
+        prefix: Annotated[StrictStr, Field(description="An optional prefix in the path")],
+        namespace: Annotated[StrictStr, Field(description="A namespace identifier as a single string. Multipart namespace parts should be separated by the unit separator (`0x1F`) byte.")],
         create_table_request: CreateTableRequest,
         x_iceberg_access_delegation: Annotated[Optional[StrictStr], Field(description="Optional signal to the server that the client supports delegated access via a comma-separated list of access mechanisms.  The server may choose to supply access via any or none of the requested mechanisms.  Specific properties and handling for `vended-credentials` is documented in the `LoadTableResult` schema section of this spec document.  The protocol and specification for `remote-signing` is documen [...]
         _request_timeout: Union[
@@ -1059,6 +1061,10 @@ class IcebergCatalogAPI:
 
         Create a table or start a create transaction, like atomic CTAS.  If `stage-create` is false, the table is created immediately.  If `stage-create` is true, the table is not created, but table metadata is initialized and returned. The service should prepare as needed for a commit to the table commit endpoint to complete the create transaction. The client uses the returned metadata to begin a transaction. To commit the transaction, the client sends all create and subsequent changes  [...]
 
+        :param prefix: An optional prefix in the path (required)
+        :type prefix: str
+        :param namespace: A namespace identifier as a single string. Multipart namespace parts should be separated by the unit separator (`0x1F`) byte. (required)
+        :type namespace: str
         :param create_table_request: (required)
         :type create_table_request: CreateTableRequest
         :param x_iceberg_access_delegation: Optional signal to the server that the client supports delegated access via a comma-separated list of access mechanisms.  The server may choose to supply access via any or none of the requested mechanisms.  Specific properties and handling for `vended-credentials` is documented in the `LoadTableResult` schema section of this spec document.  The protocol and specification for `remote-signing` is documented in  the `s3-signer-open-api.yaml` OpenA [...]
@@ -1086,6 +1092,8 @@ class IcebergCatalogAPI:
         """ # noqa: E501
 
         _param = self._create_table_serialize(
+            prefix=prefix,
+            namespace=namespace,
             create_table_request=create_table_request,
             x_iceberg_access_delegation=x_iceberg_access_delegation,
             _request_auth=_request_auth,
@@ -1119,6 +1127,8 @@ class IcebergCatalogAPI:
     @validate_call
     def create_table_with_http_info(
         self,
+        prefix: Annotated[StrictStr, Field(description="An optional prefix in the path")],
+        namespace: Annotated[StrictStr, Field(description="A namespace identifier as a single string. Multipart namespace parts should be separated by the unit separator (`0x1F`) byte.")],
         create_table_request: CreateTableRequest,
         x_iceberg_access_delegation: Annotated[Optional[StrictStr], Field(description="Optional signal to the server that the client supports delegated access via a comma-separated list of access mechanisms.  The server may choose to supply access via any or none of the requested mechanisms.  Specific properties and handling for `vended-credentials` is documented in the `LoadTableResult` schema section of this spec document.  The protocol and specification for `remote-signing` is documen [...]
         _request_timeout: Union[
@@ -1138,6 +1148,10 @@ class IcebergCatalogAPI:
 
         Create a table or start a create transaction, like atomic CTAS.  If `stage-create` is false, the table is created immediately.  If `stage-create` is true, the table is not created, but table metadata is initialized and returned. The service should prepare as needed for a commit to the table commit endpoint to complete the create transaction. The client uses the returned metadata to begin a transaction. To commit the transaction, the client sends all create and subsequent changes  [...]
 
+        :param prefix: An optional prefix in the path (required)
+        :type prefix: str
+        :param namespace: A namespace identifier as a single string. Multipart namespace parts should be separated by the unit separator (`0x1F`) byte. (required)
+        :type namespace: str
         :param create_table_request: (required)
         :type create_table_request: CreateTableRequest
         :param x_iceberg_access_delegation: Optional signal to the server that the client supports delegated access via a comma-separated list of access mechanisms.  The server may choose to supply access via any or none of the requested mechanisms.  Specific properties and handling for `vended-credentials` is documented in the `LoadTableResult` schema section of this spec document.  The protocol and specification for `remote-signing` is documented in  the `s3-signer-open-api.yaml` OpenA [...]
@@ -1165,6 +1179,8 @@ class IcebergCatalogAPI:
         """ # noqa: E501
 
         _param = self._create_table_serialize(
+            prefix=prefix,
+            namespace=namespace,
             create_table_request=create_table_request,
             x_iceberg_access_delegation=x_iceberg_access_delegation,
             _request_auth=_request_auth,
@@ -1198,6 +1214,8 @@ class IcebergCatalogAPI:
     @validate_call
     def create_table_without_preload_content(
         self,
+        prefix: Annotated[StrictStr, Field(description="An optional prefix in the path")],
+        namespace: Annotated[StrictStr, Field(description="A namespace identifier as a single string. Multipart namespace parts should be separated by the unit separator (`0x1F`) byte.")],
         create_table_request: CreateTableRequest,
         x_iceberg_access_delegation: Annotated[Optional[StrictStr], Field(description="Optional signal to the server that the client supports delegated access via a comma-separated list of access mechanisms.  The server may choose to supply access via any or none of the requested mechanisms.  Specific properties and handling for `vended-credentials` is documented in the `LoadTableResult` schema section of this spec document.  The protocol and specification for `remote-signing` is documen [...]
         _request_timeout: Union[
@@ -1217,6 +1235,10 @@ class IcebergCatalogAPI:
 
         Create a table or start a create transaction, like atomic CTAS.  If `stage-create` is false, the table is created immediately.  If `stage-create` is true, the table is not created, but table metadata is initialized and returned. The service should prepare as needed for a commit to the table commit endpoint to complete the create transaction. The client uses the returned metadata to begin a transaction. To commit the transaction, the client sends all create and subsequent changes  [...]
 
+        :param prefix: An optional prefix in the path (required)
+        :type prefix: str
+        :param namespace: A namespace identifier as a single string. Multipart namespace parts should be separated by the unit separator (`0x1F`) byte. (required)
+        :type namespace: str
         :param create_table_request: (required)
         :type create_table_request: CreateTableRequest
         :param x_iceberg_access_delegation: Optional signal to the server that the client supports delegated access via a comma-separated list of access mechanisms.  The server may choose to supply access via any or none of the requested mechanisms.  Specific properties and handling for `vended-credentials` is documented in the `LoadTableResult` schema section of this spec document.  The protocol and specification for `remote-signing` is documented in  the `s3-signer-open-api.yaml` OpenA [...]
@@ -1244,6 +1266,8 @@ class IcebergCatalogAPI:
         """ # noqa: E501
 
         _param = self._create_table_serialize(
+            prefix=prefix,
+            namespace=namespace,
             create_table_request=create_table_request,
             x_iceberg_access_delegation=x_iceberg_access_delegation,
             _request_auth=_request_auth,
@@ -1272,6 +1296,8 @@ class IcebergCatalogAPI:
 
     def _create_table_serialize(
         self,
+        prefix,
+        namespace,
         create_table_request,
         x_iceberg_access_delegation,
         _request_auth,
@@ -1293,6 +1319,10 @@ class IcebergCatalogAPI:
         _body_params: Optional[bytes] = None
 
         # process the path parameters
+        if prefix is not None:
+            _path_params['prefix'] = prefix
+        if namespace is not None:
+            _path_params['namespace'] = namespace
         # process the query parameters
         # process the header parameters
         if x_iceberg_access_delegation is not None:
diff --git a/spec/generated/bundled-polaris-catalog-service.yaml b/spec/generated/bundled-polaris-catalog-service.yaml
index e592dda7b..6c1d9dceb 100644
--- a/spec/generated/bundled-polaris-catalog-service.yaml
+++ b/spec/generated/bundled-polaris-catalog-service.yaml
@@ -440,6 +440,8 @@ paths:
         If `stage-create` is true, the table is not created, but table metadata is initialized and returned. The service should prepare as needed for a commit to the table commit endpoint to complete the create transaction. The client uses the returned metadata to begin a transaction. To commit the transaction, the client sends all create and subsequent changes to the table commit route. Changes from the table create operation include changes like AddSchemaUpdate and SetCurrentSchemaUpda [...]
       operationId: createTable
       parameters:
+        - $ref: '#/components/parameters/prefix'
+        - $ref: '#/components/parameters/namespace'
         - $ref: '#/components/parameters/data-access'
       requestBody:
         required: true
diff --git a/spec/iceberg-rest-catalog-open-api.yaml b/spec/iceberg-rest-catalog-open-api.yaml
index d1f5bb1c4..73af389b5 100644
--- a/spec/iceberg-rest-catalog-open-api.yaml
+++ b/spec/iceberg-rest-catalog-open-api.yaml
@@ -559,6 +559,8 @@ paths:
         table state.
       operationId: createTable
       parameters:
+        - $ref: '#/components/parameters/prefix'
+        - $ref: '#/components/parameters/namespace'
         - $ref: '#/components/parameters/data-access'
       requestBody:
         required: true