Skip to content

Commit 3b18e0d

Browse files
authored
Automate regeneration of Python client (#1675)
When running regtests or the CLI, we should run `./gradlew regeneratePythonClient` in order to run against the most up-to-date Python client. As part of this change, I've also updated the generator to 7.12 to match what's in the `libs.version.toml` and regenerated the code managed in github. Once the automatic generation works as part of CI, we can remove the generated code from the repo altogether. In the future, it can be added to .gitignore.
1 parent 0a8d8b8 commit 3b18e0d

File tree

93 files changed

+1446
-685
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1446
-685
lines changed

.github/workflows/python-client.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ jobs:
4444
- name: Checkout Polaris project
4545
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
4646

47+
- name: Set up JDK for Gradle
48+
uses: actions/setup-java@v4
49+
with:
50+
distribution: 'temurin'
51+
java-version: '21'
52+
53+
- name: Run regeneratePythonClient
54+
run: ./gradlew regeneratePythonClient
55+
4756
- name: Set up Python ${{ matrix.python-version }}
4857
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
4958
with:

.github/workflows/regtest.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ jobs:
4343
- name: Fix permissions
4444
run: mkdir -p regtests/output && chmod 777 regtests/output && chmod 777 regtests/t_*/ref/*
4545

46+
- name: Run regeneratePythonClient
47+
run: ./gradlew regeneratePythonClient
48+
4649
- name: Image build
4750
run: |
4851
./gradlew \

.github/workflows/spark_client_regtests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ jobs:
4343
- name: Fix permissions
4444
run: mkdir -p regtests/output && chmod 777 regtests/output && chmod 777 regtests/t_*/ref/*
4545

46+
- name: Run regeneratePythonClient
47+
run: ./gradlew regeneratePythonClient
48+
4649
- name: Project build without testing
4750
run: ./gradlew assemble
4851

client/python/.openapi-generator-ignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,12 @@
4040
#docs/*.md
4141
# Then explicitly reverse the ignore rule for a single file:
4242
#!docs/README.md
43+
44+
.github/workflows/python.yml
45+
.gitlab-ci.yml
46+
pyproject.toml
47+
requirements.txt
48+
test-requirements.txt
49+
setup.py
50+
51+

client/python/.openapi-generator/FILES

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
.github/workflows/python.yml
21
.gitignore
3-
.gitlab-ci.yml
42
.travis.yml
53
README.md
64
docs/AddPartitionSpecUpdate.md
@@ -274,11 +272,7 @@ polaris/catalog/models/view_update.py
274272
polaris/catalog/models/view_version.py
275273
polaris/catalog/py.typed
276274
polaris/catalog/rest.py
277-
pyproject.toml
278-
requirements.txt
279275
setup.cfg
280-
setup.py
281-
test-requirements.txt
282276
test/__init__.py
283277
test/test_async_planning_result.py
284278
test/test_completed_planning_result.py
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.8.0-SNAPSHOT
1+
7.12.0

client/python/.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
# ref: https://docs.travis-ci.com/user/languages/python
2121
language: python
2222
python:
23-
- "3.7"
2423
- "3.8"
2524
- "3.9"
2625
- "3.10"
2726
- "3.11"
27+
- "3.12"
2828
# uncomment the following if needed
29-
#- "3.11-dev" # 3.11 development branch
29+
#- "3.12-dev" # 3.12 development branch
3030
#- "nightly" # nightly build
3131
# command to install dependencies
3232
install:

client/python/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ This Python package is automatically generated by the [OpenAPI Generator](https:
2525

2626
- API version: 0.0.1
2727
- Package version: 1.0.0
28-
- Generator version: 7.8.0-SNAPSHOT
28+
- Generator version: 7.12.0
2929
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
3030

3131
## Requirements.
3232

33-
Python 3.7+
33+
Python 3.8+
3434

3535
## Installation & Usage
3636
### pip install

client/python/docs/CatalogAPI.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,11 @@ Name | Type | Description | Notes
238238
239239
Create a table in the given namespace
240240

241-
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 to the table commit route. Changes from the table create operation include changes like AddSchemaUpdate and SetCurrentSchemaUpdate that set the initial table state.
241+
Create a table or start a create transaction, like atomic CTAS.
242+
243+
If `stage-create` is false, the table is created immediately.
244+
245+
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 SetCurrentSchemaUpdate that set the initial table state.
242246

243247
### Example
244248

@@ -693,7 +697,7 @@ void (empty response body)
693697
694698
List namespaces, optionally providing a parent namespace to list underneath
695699

696-
List all namespaces at a certain level, optionally starting from a given parent namespace. If table accounting.tax.paid.info exists, using 'SELECT NAMESPACE IN accounting' would translate into `GET /namespaces?parent=accounting` and must return a namespace, [\"accounting\", \"tax\"] only. Using 'SELECT NAMESPACE IN accounting.tax' would translate into `GET /namespaces?parent=accounting%1Ftax` and must return a namespace, [\"accounting\", \"tax\", \"paid\"]. If `parent` is not provided, all top-level namespaces should be listed.
700+
List all namespaces at a certain level, optionally starting from a given parent namespace. If table accounting.tax.paid.info exists, using 'SELECT NAMESPACE IN accounting' would translate into `GET /namespaces?parent=accounting` and must return a namespace, ["accounting", "tax"] only. Using 'SELECT NAMESPACE IN accounting.tax' would translate into `GET /namespaces?parent=accounting%1Ftax` and must return a namespace, ["accounting", "tax", "paid"]. If `parent` is not provided, all top-level namespaces should be listed.
697701

698702
### Example
699703

@@ -1157,7 +1161,13 @@ Name | Type | Description | Notes
11571161
11581162
Load a table from the catalog
11591163

1160-
Load a table from the catalog. The response contains both configuration and table metadata. The configuration, if non-empty is used as additional configuration for the table that overrides catalog configuration. For example, this configuration may change the FileIO implementation to be used for the table. The response also contains the table's full metadata, matching the table metadata JSON file. The catalog configuration may contain credentials that should be used for subsequent requests for the table. The configuration key \"token\" is used to pass an access token to be used as a bearer token for table requests. Otherwise, a token may be passed using a RFC 8693 token type as a configuration key. For example, \"urn:ietf:params:oauth:token-type:jwt=<JWT-token>\".
1164+
Load a table from the catalog.
1165+
1166+
The response contains both configuration and table metadata. The configuration, if non-empty is used as additional configuration for the table that overrides catalog configuration. For example, this configuration may change the FileIO implementation to be used for the table.
1167+
1168+
The response also contains the table's full metadata, matching the table metadata JSON file.
1169+
1170+
The catalog configuration may contain credentials that should be used for subsequent requests for the table. The configuration key "token" is used to pass an access token to be used as a bearer token for table requests. Otherwise, a token may be passed using a RFC 8693 token type as a configuration key. For example, "urn:ietf:params:oauth:token-type:jwt=<JWT-token>".
11611171

11621172
### Example
11631173

@@ -1256,7 +1266,13 @@ Name | Type | Description | Notes
12561266
12571267
Load a view from the catalog
12581268

1259-
Load a view from the catalog. The response contains both configuration and view metadata. The configuration, if non-empty is used as additional configuration for the view that overrides catalog configuration. The response also contains the view's full metadata, matching the view metadata JSON file. The catalog configuration may contain credentials that should be used for subsequent requests for the view. The configuration key \"token\" is used to pass an access token to be used as a bearer token for view requests. Otherwise, a token may be passed using a RFC 8693 token type as a configuration key. For example, \"urn:ietf:params:oauth:token-type:jwt=<JWT-token>\".
1269+
Load a view from the catalog.
1270+
1271+
The response contains both configuration and view metadata. The configuration, if non-empty is used as additional configuration for the view that overrides catalog configuration.
1272+
1273+
The response also contains the view's full metadata, matching the view metadata JSON file.
1274+
1275+
The catalog configuration may contain credentials that should be used for subsequent requests for the view. The configuration key "token" is used to pass an access token to be used as a bearer token for view requests. Otherwise, a token may be passed using a RFC 8693 token type as a configuration key. For example, "urn:ietf:params:oauth:token-type:jwt=<JWT-token>".
12601276

12611277
### Example
12621278

@@ -2078,7 +2094,9 @@ void (empty response body)
20782094
20792095
Set or remove properties on a namespace
20802096

2081-
Set and/or remove properties on a namespace. The request body specifies a list of properties to remove and a map of key value pairs to update. Properties that are not in the request are not modified or removed by this call. Server implementations are not required to support namespace properties.
2097+
Set and/or remove properties on a namespace. The request body specifies a list of properties to remove and a map of key value pairs to update.
2098+
Properties that are not in the request are not modified or removed by this call.
2099+
Server implementations are not required to support namespace properties.
20822100

20832101
### Example
20842102

@@ -2173,7 +2191,13 @@ Name | Type | Description | Notes
21732191
21742192
Commit updates to a table
21752193

2176-
Commit updates to a table. Commits have two parts, requirements and updates. Requirements are assertions that will be validated before attempting to make and commit changes. For example, `assert-ref-snapshot-id` will check that a named ref's snapshot ID has a certain value. Server implementations are required to fail with a 400 status code if any unknown updates or requirements are received. Updates are changes to make to table metadata. For example, after asserting that the current main ref is at the expected snapshot, a commit may add a new child snapshot and set the ref to the new snapshot id. Create table transactions that are started by createTable with `stage-create` set to true are committed using this route. Transactions should include all changes to the table, including table initialization, like AddSchemaUpdate and SetCurrentSchemaUpdate. The `assert-create` requirement is used to ensure that the table was not created concurrently.
2194+
Commit updates to a table.
2195+
2196+
Commits have two parts, requirements and updates. Requirements are assertions that will be validated before attempting to make and commit changes. For example, `assert-ref-snapshot-id` will check that a named ref's snapshot ID has a certain value. Server implementations are required to fail with a 400 status code if any unknown updates or requirements are received.
2197+
2198+
Updates are changes to make to table metadata. For example, after asserting that the current main ref is at the expected snapshot, a commit may add a new child snapshot and set the ref to the new snapshot id.
2199+
2200+
Create table transactions that are started by createTable with `stage-create` set to true are committed using this route. Transactions should include all changes to the table, including table initialization, like AddSchemaUpdate and SetCurrentSchemaUpdate. The `assert-create` requirement is used to ensure that the table was not created concurrently.
21772201

21782202
### Example
21792203

client/python/docs/ConfigurationAPI.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,31 @@ Method | HTTP request | Description
3232
3333
List all catalog configuration settings
3434

35-
All REST clients should first call this route to get catalog configuration properties from the server to configure the catalog and its HTTP client. Configuration from the server consists of two sets of key/value pairs. - defaults - properties that should be used as default configuration; applied before client configuration - overrides - properties that should be used to override client configuration; applied after defaults and client configuration Catalog configuration is constructed by setting the defaults, then client- provided configuration, and finally overrides. The final property set is then used to configure the catalog. For example, a default configuration property might set the size of the client pool, which can be replaced with a client-specific setting. An override might be used to set the warehouse location, which is stored on the server rather than in client configuration. Common catalog configuration settings are documented at https://iceberg.apache.org/docs/latest/configuration/#catalog-properties The catalog configuration also holds an optional `endpoints` field that contains information about the endpoints supported by the server. If a server does not send the `endpoints` field, a default set of endpoints is assumed: - GET /v1/{prefix}/namespaces - POST /v1/{prefix}/namespaces - GET /v1/{prefix}/namespaces/{namespace} - DELETE /v1/{prefix}/namespaces/{namespace} - POST /v1/{prefix}/namespaces/{namespace}/properties - GET /v1/{prefix}/namespaces/{namespace}/tables - POST /v1/{prefix}/namespaces/{namespace}/tables - GET /v1/{prefix}/namespaces/{namespace}/tables/{table} - POST /v1/{prefix}/namespaces/{namespace}/tables/{table} - DELETE /v1/{prefix}/namespaces/{namespace}/tables/{table} - POST /v1/{prefix}/namespaces/{namespace}/register - POST /v1/{prefix}/namespaces/{namespace}/tables/{table}/metrics - POST /v1/{prefix}/tables/rename - POST /v1/{prefix}/transactions/commit
35+
All REST clients should first call this route to get catalog configuration properties from the server to configure the catalog and its HTTP client. Configuration from the server consists of two sets of key/value pairs.
36+
- defaults - properties that should be used as default configuration; applied before client configuration
37+
- overrides - properties that should be used to override client configuration; applied after defaults and client configuration
38+
39+
Catalog configuration is constructed by setting the defaults, then client- provided configuration, and finally overrides. The final property set is then used to configure the catalog.
40+
41+
For example, a default configuration property might set the size of the client pool, which can be replaced with a client-specific setting. An override might be used to set the warehouse location, which is stored on the server rather than in client configuration.
42+
43+
Common catalog configuration settings are documented at https://iceberg.apache.org/docs/latest/configuration/#catalog-properties
44+
45+
The catalog configuration also holds an optional `endpoints` field that contains information about the endpoints supported by the server. If a server does not send the `endpoints` field, a default set of endpoints is assumed:
46+
- GET /v1/{prefix}/namespaces
47+
- POST /v1/{prefix}/namespaces
48+
- GET /v1/{prefix}/namespaces/{namespace}
49+
- DELETE /v1/{prefix}/namespaces/{namespace}
50+
- POST /v1/{prefix}/namespaces/{namespace}/properties
51+
- GET /v1/{prefix}/namespaces/{namespace}/tables
52+
- POST /v1/{prefix}/namespaces/{namespace}/tables
53+
- GET /v1/{prefix}/namespaces/{namespace}/tables/{table}
54+
- POST /v1/{prefix}/namespaces/{namespace}/tables/{table}
55+
- DELETE /v1/{prefix}/namespaces/{namespace}/tables/{table}
56+
- POST /v1/{prefix}/namespaces/{namespace}/register
57+
- POST /v1/{prefix}/namespaces/{namespace}/tables/{table}/metrics
58+
- POST /v1/{prefix}/tables/rename
59+
- POST /v1/{prefix}/transactions/commit
3660

3761
### Example
3862

0 commit comments

Comments
 (0)