Skip to content

Commit af26732

Browse files
authored
Create a wrapper script to generate python client; regenerate the python client (#1347)
As noted in #755 and elsewhere, the generated types in client/python are currently out of date. This introduces a script to regenerate them and a gradle task to run that script. I've also run the script, which necessitated several things to get tests passing: 1. There were small nonfunctional spec changes needed in order to keep the Python client working 2. The CLI and its tests required a few fixes to work with the updated Python client 3. Many of the regtests required fixes to work with the updated Python client
1 parent 6e6da48 commit af26732

File tree

638 files changed

+32824
-2386
lines changed

Some content is hidden

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

638 files changed

+32824
-2386
lines changed

build.gradle.kts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,18 @@ tasks.named<RatTask>("rat").configure {
141141
excludes.add("plugins/**/*.ref")
142142
}
143143

144+
tasks.register<Exec>("regeneratePythonClient") {
145+
description = "Regenerates the python client"
146+
147+
workingDir = project.projectDir
148+
commandLine("bash", "client/templates/regenerate.sh")
149+
150+
dependsOn(":polaris-api-iceberg-service:processResources")
151+
dependsOn(":polaris-api-management-service:processResources")
152+
dependsOn(":polaris-api-catalog-service:processResources")
153+
dependsOn(":polaris-api-management-model:processResources")
154+
}
155+
144156
// Pass environment variables:
145157
// ORG_GRADLE_PROJECT_apacheUsername
146158
// ORG_GRADLE_PROJECT_apachePassword

client/python/.github/workflows/python.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#
2323
# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
2424

25-
name: polaris.management Python package
25+
name: polaris.catalog Python package
2626

2727
on: [push, pull_request]
2828

@@ -35,9 +35,9 @@ jobs:
3535
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
3636

3737
steps:
38-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
38+
- uses: actions/checkout@v3
3939
- name: Set up Python ${{ matrix.python-version }}
40-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
40+
uses: actions/setup-python@v4
4141
with:
4242
python-version: ${{ matrix.python-version }}
4343
- name: Install dependencies

client/python/.gitlab-ci.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
# NOTE: This file is auto generated by OpenAPI Generator.
21+
# URL: https://openapi-generator.tech
22+
#
23+
# ref: https://docs.gitlab.com/ee/ci/README.html
24+
# ref: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml
25+
26+
stages:
27+
- test
28+
29+
.pytest:
30+
stage: test
31+
script:
32+
- pip install -r requirements.txt
33+
- pip install -r test-requirements.txt
34+
- pytest --cov=polaris.catalog
35+
36+
pytest-3.7:
37+
extends: .pytest
38+
image: python:3.7-alpine
39+
pytest-3.8:
40+
extends: .pytest
41+
image: python:3.8-alpine
42+
pytest-3.9:
43+
extends: .pytest
44+
image: python:3.9-alpine
45+
pytest-3.10:
46+
extends: .pytest
47+
image: python:3.10-alpine
48+
pytest-3.11:
49+
extends: .pytest
50+
image: python:3.11-alpine

client/python/.openapi-generator/FILES

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ docs/AssertRefSnapshotId.md
1919
docs/AssertTableUUID.md
2020
docs/AssertViewUUID.md
2121
docs/AssignUUIDUpdate.md
22+
docs/AsyncPlanningResult.md
2223
docs/BaseUpdate.md
2324
docs/BlobMetadata.md
2425
docs/CatalogConfig.md
@@ -27,6 +28,8 @@ docs/CommitTableRequest.md
2728
docs/CommitTableResponse.md
2829
docs/CommitTransactionRequest.md
2930
docs/CommitViewRequest.md
31+
docs/CompletedPlanningResult.md
32+
docs/CompletedPlanningWithIDResult.md
3033
docs/ContentFile.md
3134
docs/CountMap.md
3235
docs/CounterResult.md
@@ -35,10 +38,19 @@ docs/CreateNamespaceResponse.md
3538
docs/CreateTableRequest.md
3639
docs/CreateViewRequest.md
3740
docs/DataFile.md
41+
docs/DeleteFile.md
42+
docs/EmptyPlanningResult.md
43+
docs/EnableRowLineageUpdate.md
3844
docs/EqualityDeleteFile.md
3945
docs/ErrorModel.md
4046
docs/Expression.md
47+
docs/FailedPlanningResult.md
48+
docs/FalseExpression.md
49+
docs/FetchPlanningResult.md
50+
docs/FetchScanTasksRequest.md
51+
docs/FetchScanTasksResult.md
4152
docs/FileFormat.md
53+
docs/FileScanTask.md
4254
docs/GetNamespaceResponse.md
4355
docs/IcebergCatalogAPI.md
4456
docs/IcebergConfigurationAPI.md
@@ -48,24 +60,27 @@ docs/ListNamespacesResponse.md
4860
docs/ListTablesResponse.md
4961
docs/ListType.md
5062
docs/LiteralExpression.md
63+
docs/LoadCredentialsResponse.md
5164
docs/LoadTableResult.md
5265
docs/LoadViewResult.md
5366
docs/MapType.md
5467
docs/MetadataLogInner.md
5568
docs/MetricResult.md
5669
docs/ModelSchema.md
5770
docs/NotExpression.md
58-
docs/NotificationRequest.md
59-
docs/NotificationType.md
6071
docs/NullOrder.md
6172
docs/OAuthError.md
6273
docs/OAuthTokenResponse.md
6374
docs/PartitionField.md
6475
docs/PartitionSpec.md
6576
docs/PartitionStatisticsFile.md
77+
docs/PlanStatus.md
78+
docs/PlanTableScanRequest.md
79+
docs/PlanTableScanResult.md
6680
docs/PositionDeleteFile.md
6781
docs/PrimitiveTypeValue.md
6882
docs/RegisterTableRequest.md
83+
docs/RemovePartitionSpecsUpdate.md
6984
docs/RemovePartitionStatisticsUpdate.md
7085
docs/RemovePropertiesUpdate.md
7186
docs/RemoveSnapshotRefUpdate.md
@@ -75,6 +90,7 @@ docs/RenameTableRequest.md
7590
docs/ReportMetricsRequest.md
7691
docs/SQLViewRepresentation.md
7792
docs/ScanReport.md
93+
docs/ScanTasks.md
7894
docs/SetCurrentSchemaUpdate.md
7995
docs/SetCurrentViewVersionUpdate.md
8096
docs/SetDefaultSortOrderUpdate.md
@@ -93,17 +109,18 @@ docs/SortDirection.md
93109
docs/SortField.md
94110
docs/SortOrder.md
95111
docs/StatisticsFile.md
112+
docs/StorageCredential.md
96113
docs/StructField.md
97114
docs/StructType.md
98115
docs/TableIdentifier.md
99116
docs/TableMetadata.md
100117
docs/TableRequirement.md
101118
docs/TableUpdate.md
102-
docs/TableUpdateNotification.md
103119
docs/Term.md
104120
docs/TimerResult.md
105121
docs/TokenType.md
106122
docs/TransformTerm.md
123+
docs/TrueExpression.md
107124
docs/Type.md
108125
docs/UnaryExpression.md
109126
docs/UpdateNamespacePropertiesRequest.md
@@ -144,6 +161,7 @@ polaris/catalog/models/assert_ref_snapshot_id.py
144161
polaris/catalog/models/assert_table_uuid.py
145162
polaris/catalog/models/assert_view_uuid.py
146163
polaris/catalog/models/assign_uuid_update.py
164+
polaris/catalog/models/async_planning_result.py
147165
polaris/catalog/models/base_update.py
148166
polaris/catalog/models/blob_metadata.py
149167
polaris/catalog/models/catalog_config.py
@@ -152,6 +170,8 @@ polaris/catalog/models/commit_table_request.py
152170
polaris/catalog/models/commit_table_response.py
153171
polaris/catalog/models/commit_transaction_request.py
154172
polaris/catalog/models/commit_view_request.py
173+
polaris/catalog/models/completed_planning_result.py
174+
polaris/catalog/models/completed_planning_with_id_result.py
155175
polaris/catalog/models/content_file.py
156176
polaris/catalog/models/count_map.py
157177
polaris/catalog/models/counter_result.py
@@ -160,34 +180,46 @@ polaris/catalog/models/create_namespace_response.py
160180
polaris/catalog/models/create_table_request.py
161181
polaris/catalog/models/create_view_request.py
162182
polaris/catalog/models/data_file.py
183+
polaris/catalog/models/delete_file.py
184+
polaris/catalog/models/empty_planning_result.py
185+
polaris/catalog/models/enable_row_lineage_update.py
163186
polaris/catalog/models/equality_delete_file.py
164187
polaris/catalog/models/error_model.py
165188
polaris/catalog/models/expression.py
189+
polaris/catalog/models/failed_planning_result.py
190+
polaris/catalog/models/false_expression.py
191+
polaris/catalog/models/fetch_planning_result.py
192+
polaris/catalog/models/fetch_scan_tasks_request.py
193+
polaris/catalog/models/fetch_scan_tasks_result.py
166194
polaris/catalog/models/file_format.py
195+
polaris/catalog/models/file_scan_task.py
167196
polaris/catalog/models/get_namespace_response.py
168197
polaris/catalog/models/iceberg_error_response.py
169198
polaris/catalog/models/list_namespaces_response.py
170199
polaris/catalog/models/list_tables_response.py
171200
polaris/catalog/models/list_type.py
172201
polaris/catalog/models/literal_expression.py
202+
polaris/catalog/models/load_credentials_response.py
173203
polaris/catalog/models/load_table_result.py
174204
polaris/catalog/models/load_view_result.py
175205
polaris/catalog/models/map_type.py
176206
polaris/catalog/models/metadata_log_inner.py
177207
polaris/catalog/models/metric_result.py
178208
polaris/catalog/models/model_schema.py
179209
polaris/catalog/models/not_expression.py
180-
polaris/catalog/models/notification_request.py
181-
polaris/catalog/models/notification_type.py
182210
polaris/catalog/models/null_order.py
183211
polaris/catalog/models/o_auth_error.py
184212
polaris/catalog/models/o_auth_token_response.py
185213
polaris/catalog/models/partition_field.py
186214
polaris/catalog/models/partition_spec.py
187215
polaris/catalog/models/partition_statistics_file.py
216+
polaris/catalog/models/plan_status.py
217+
polaris/catalog/models/plan_table_scan_request.py
218+
polaris/catalog/models/plan_table_scan_result.py
188219
polaris/catalog/models/position_delete_file.py
189220
polaris/catalog/models/primitive_type_value.py
190221
polaris/catalog/models/register_table_request.py
222+
polaris/catalog/models/remove_partition_specs_update.py
191223
polaris/catalog/models/remove_partition_statistics_update.py
192224
polaris/catalog/models/remove_properties_update.py
193225
polaris/catalog/models/remove_snapshot_ref_update.py
@@ -196,6 +228,7 @@ polaris/catalog/models/remove_statistics_update.py
196228
polaris/catalog/models/rename_table_request.py
197229
polaris/catalog/models/report_metrics_request.py
198230
polaris/catalog/models/scan_report.py
231+
polaris/catalog/models/scan_tasks.py
199232
polaris/catalog/models/set_current_schema_update.py
200233
polaris/catalog/models/set_current_view_version_update.py
201234
polaris/catalog/models/set_default_sort_order_update.py
@@ -215,17 +248,18 @@ polaris/catalog/models/sort_field.py
215248
polaris/catalog/models/sort_order.py
216249
polaris/catalog/models/sql_view_representation.py
217250
polaris/catalog/models/statistics_file.py
251+
polaris/catalog/models/storage_credential.py
218252
polaris/catalog/models/struct_field.py
219253
polaris/catalog/models/struct_type.py
220254
polaris/catalog/models/table_identifier.py
221255
polaris/catalog/models/table_metadata.py
222256
polaris/catalog/models/table_requirement.py
223257
polaris/catalog/models/table_update.py
224-
polaris/catalog/models/table_update_notification.py
225258
polaris/catalog/models/term.py
226259
polaris/catalog/models/timer_result.py
227260
polaris/catalog/models/token_type.py
228261
polaris/catalog/models/transform_term.py
262+
polaris/catalog/models/true_expression.py
229263
polaris/catalog/models/type.py
230264
polaris/catalog/models/unary_expression.py
231265
polaris/catalog/models/update_namespace_properties_request.py
@@ -246,4 +280,28 @@ setup.cfg
246280
setup.py
247281
test-requirements.txt
248282
test/__init__.py
283+
test/test_async_planning_result.py
284+
test/test_completed_planning_result.py
285+
test/test_completed_planning_with_id_result.py
286+
test/test_content_file.py
287+
test/test_count_map.py
288+
test/test_data_file.py
289+
test/test_delete_file.py
290+
test/test_empty_planning_result.py
291+
test/test_equality_delete_file.py
292+
test/test_failed_planning_result.py
293+
test/test_fetch_planning_result.py
294+
test/test_fetch_scan_tasks_request.py
295+
test/test_fetch_scan_tasks_result.py
296+
test/test_file_format.py
297+
test/test_file_scan_task.py
298+
test/test_iceberg_catalog_api.py
299+
test/test_iceberg_configuration_api.py
300+
test/test_iceberg_o_auth2_api.py
301+
test/test_plan_status.py
302+
test/test_plan_table_scan_request.py
303+
test/test_plan_table_scan_result.py
304+
test/test_position_delete_file.py
305+
test/test_scan_tasks.py
306+
test/test_value_map.py
249307
tox.ini

client/python/.travis.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
# ref: https://docs.travis-ci.com/user/languages/python
21+
language: python
22+
python:
23+
- "3.7"
24+
- "3.8"
25+
- "3.9"
26+
- "3.10"
27+
- "3.11"
28+
# uncomment the following if needed
29+
#- "3.11-dev" # 3.11 development branch
30+
#- "nightly" # nightly build
31+
# command to install dependencies
32+
install:
33+
- "pip install -r requirements.txt"
34+
- "pip install -r test-requirements.txt"
35+
# command to run tests
36+
script: pytest --cov=polaris.catalog

0 commit comments

Comments
 (0)