Skip to content

[#12116] improvement(client-python): Add view create/drop operations#12117

Merged
jerryshao merged 2 commits into
apache:mainfrom
kevinw66:view-pyclient-createdrop-api
Jul 22, 2026
Merged

[#12116] improvement(client-python): Add view create/drop operations#12117
jerryshao merged 2 commits into
apache:mainfrom
kevinw66:view-pyclient-createdrop-api

Conversation

@kevinw66

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

  • Extend RelationalCatalog with ViewCatalog.
  • Add as_view_catalog, create_view, and drop_view.
  • Add request and response DTOs for view creation.
  • Add view-specific REST error handling.
  • Generalize the entity namespace helper for table and view operations.
  • Add corresponding unit and integration tests.

Why are the changes needed?

The Python client currently lacks support for view create/drop operations. These changes allow users to create and drop views through the Python client.

Fix: #12116

Does this PR introduce any user-facing change?

Yes. Python client users can now create and drop views through RelationalCatalog.as_view_catalog().

How was this patch tested?

Added unit tests for request and response validation, REST error handling, and view create/drop operations.

Added integration tests covering view creation, duplicate creation, view deletion, and deletion of nonexistent views.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

Code Coverage Report

Overall Project 67.78% 🟢
Files changed No Java source files changed -

Module Coverage
aliyun 1.72% 🔴
api 47.82% 🟢
authorization-common 85.96% 🟢
aws 42.04% 🟢
azure 2.47% 🔴
catalog-common 9.92% 🔴
catalog-fileset 79.74% 🟢
catalog-glue 66.91% 🟢
catalog-hive 79.4% 🟢
catalog-jdbc-common 45.7% 🟢
catalog-jdbc-doris 81.72% 🟢
catalog-jdbc-mysql 79.33% 🟢
catalog-jdbc-postgresql 83.39% 🟢
catalog-jdbc-starrocks 79.16% 🟢
catalog-kafka 77.01% 🟢
catalog-lakehouse-generic 59.18% 🟢
catalog-lakehouse-hudi 79.1% 🟢
catalog-lakehouse-iceberg 85.93% 🟢
catalog-lakehouse-paimon 84.23% 🟢
catalog-model 77.72% 🟢
cli 44.5% 🟢
client-java 78.27% 🟢
common 51.95% 🟢
core 82.55% 🟢
filesystem-hadoop3 77.28% 🟢
flink 0.0% 🔴
flink-common 47.09% 🟢
flink-runtime 0.0% 🔴
gcp 14.12% 🔴
hadoop-auth 68.0% 🟢
hadoop-common 12.7% 🔴
hive-metastore-common 53.4% 🟢
iceberg-common 64.65% 🟢
iceberg-rest-server 74.91% 🟢
idp-basic 86.02% 🟢
integration-test-common 0.0% 🔴
jobs 66.17% 🟢
lance-common 20.67% 🔴
lance-rest-server 64.84% 🟢
lineage 53.02% 🟢
optimizer 83.17% 🟢
optimizer-api 21.95% 🔴
server 86.05% 🟢
server-common 76.12% 🟢
spark 28.57% 🔴
spark-common 46.01% 🟢
tencent 69.84% 🟢
trino-connector 40.29% 🟢

@kevinw66

Copy link
Copy Markdown
Contributor Author

@jerryshao @mchades Could you help review this? Thanks!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds view create/drop support to the Gravitino Python client’s relational catalog, introducing view-specific DTOs and REST error handling and expanding tests to cover the new functionality.

Changes:

  • Extend RelationalCatalog to implement ViewCatalog and add as_view_catalog(), create_view(), and drop_view().
  • Add view REST DTOs (ViewCreateRequest, ViewResponse) and a view-specific REST error handler.
  • Add unit and integration tests for view create/drop behavior and error handling.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
clients/client-python/gravitino/client/relational_catalog.py Implements ViewCatalog on RelationalCatalog and adds view create/drop REST calls plus shared namespace/path helpers.
clients/client-python/gravitino/dto/requests/view_create_request.py Adds DTO for view creation requests, including validation and representation (de)serialization.
clients/client-python/gravitino/dto/responses/view_response.py Adds DTO for view operation responses with validation.
clients/client-python/gravitino/exceptions/handlers/view_error_handler.py Adds view-specific REST error handling and exception mapping.
clients/client-python/tests/unittests/test_relational_catalog.py Adds unit tests for as_view_catalog, create_view, and drop_view.
clients/client-python/tests/unittests/test_error_handler.py Adds unit tests for the new VIEW_ERROR_HANDLER.
clients/client-python/tests/unittests/dto/requests/test_view_create_request.py Adds unit tests for ViewCreateRequest validation and JSON serialization.
clients/client-python/tests/unittests/dto/responses/test_view_response.py Adds unit tests for ViewResponse validation and round-trip serialization.
clients/client-python/tests/integration/test_relational_catalog.py Adds integration tests for view creation, duplicate creation, deletion, and deletion of nonexistent views.

Comment thread clients/client-python/gravitino/dto/requests/view_create_request.py
Comment thread clients/client-python/tests/integration/test_relational_catalog.py Outdated
@jerryshao

Copy link
Copy Markdown
Contributor

Overall LGTM, just some minor issues.

@kevinw66

Copy link
Copy Markdown
Contributor Author

Overall LGTM, just some minor issues.

Thanks! Just updated.

@jerryshao
jerryshao merged commit 941f030 into apache:main Jul 22, 2026
35 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Subtask] Support view create/drop operations in Python client

3 participants