Skip to content

[#12441] feat(client-python): Support tag assignment values - #12442

Open
roryqi wants to merge 2 commits into
apache:mainfrom
qqqttt123:tag-assignment-values-python-client
Open

[#12441] feat(client-python): Support tag assignment values#12442
roryqi wants to merge 2 commits into
apache:mainfrom
qqqttt123:tag-assignment-values-python-client

Conversation

@roryqi

@roryqi roryqi commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR adds Python client support for tag assignment values:

  • Add allowed_values support to tag creation and tag DTOs.
  • Add assignment-context values to detailed tag models.
  • Add tag-value pair request support for object tag assignment.
  • Add assign_tags(...) while keeping associate_tags(...) compatible.
  • Add value-filtered associated-object lookup through tag.associated_objects().objects(value=...).
  • Add unit tests for DTO serialization, client request paths, and new APIs.

Why are the changes needed?

Python client APIs need to match the tag assignment values REST design so users can create tags with allowed values, assign values such as data_domain=finance to metadata objects, and find objects through the existing tag associated-object lookup API.

Fix: #12441

Does this PR introduce any user-facing change?

Yes. The Python client adds:

  • create_tag(..., allowed_values=None)
  • Tag.allowed_values()
  • Tag.assignment_values()
  • SupportsTags.assign_tags(...)
  • tag.associated_objects().objects(value=None)

Existing associate_tags(...) remains available.

How was this patch tested?

  • PYTHONPATH=/tmp/gravitino-python-tag-values-pr/clients/client-python python -m unittest tests.unittests.test_generic_tag tests.unittests.dto.requests.test_tags_associate_request tests.unittests.dto.requests.test_tag_create_request tests.unittests.dto.test_tag_dto tests.unittests.test_generic_view tests.unittests.test_generic_function tests.unittests.client.test_metadata_object_tag_operations tests.unittests.test_tag_api
  • PYTHONPATH=/tmp/gravitino-python-tag-values-pr/clients/client-python python -m unittest discover tests/unittests
  • black --check ./gravitino ./tests/unittests ./scripts
  • pylint <changed files>

Also ran ./gradlew :clients:client-python:test; black passed, but the full integration test task failed due to existing environment issues: Python client version 2.0.0.dev0 was higher than server 1.3.1-SNAPSHOT, and Docker image apache/gravitino-ci:hive-0.1.13 was missing.

@roryqi
roryqi force-pushed the tag-assignment-values-python-client branch 3 times, most recently from db2144d to 2b79236 Compare August 12, 2026 13:48
@roryqi
roryqi force-pushed the tag-assignment-values-python-client branch from 2b79236 to c1f4bf0 Compare August 12, 2026 13:50
@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown

Code Coverage Report

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

Module Coverage
aliyun 1.72% 🔴
api 49.31% 🟢
authorization-common 85.96% 🟢
aws 42.04% 🟢
azure 2.47% 🔴
catalog-common 9.92% 🔴
catalog-fileset 79.77% 🟢
catalog-glue 68.95% 🟢
catalog-hive 79.4% 🟢
catalog-jdbc-common 45.7% 🟢
catalog-jdbc-doris 81.8% 🟢
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.86% 🟢
catalog-lakehouse-paimon 84.23% 🟢
catalog-model 77.72% 🟢
cli 44.48% 🟢
client-java 78.46% 🟢
common 52.75% 🟢
core 83.63% 🟢
filesystem-hadoop3 77.28% 🟢
flink 0.0% 🔴
flink-common 48.68% 🟢
flink-runtime 0.0% 🔴
gcp 14.12% 🔴
hadoop-auth 68.0% 🟢
hadoop-common 12.7% 🔴
hive-metastore-common 53.4% 🟢
iceberg-aliyun-bundle 0.0% 🔴
iceberg-common 64.75% 🟢
iceberg-rest-server 75.03% 🟢
idp-basic 86.02% 🟢
integration-test-common 0.0% 🔴
jobs 62.92% 🟢
lance-common 31.75% 🔴
lance-rest-server 63.47% 🟢
lineage 53.02% 🟢
optimizer 83.24% 🟢
optimizer-api 21.95% 🔴
server 87.25% 🟢
server-common 79.41% 🟢
spark 28.57% 🔴
spark-common 45.89% 🟢
tencent 69.84% 🟢
trino-connector 40.29% 🟢

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

Adds Python client support for tag assignment values across DTOs, tag APIs, metadata objects, and associated-object filtering.

Changes:

  • Adds allowed and assignment values to tag models and creation.
  • Adds value-pair assignment APIs while retaining legacy association.
  • Adds value-filtered lookup and unit coverage.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/unittests/test_tag_api.py Tests tag creation with allowed values.
tests/unittests/test_generic_view.py Verifies view assignment support.
tests/unittests/test_generic_tag.py Tests values and filtered lookup.
tests/unittests/test_generic_function.py Verifies function assignment support.
tests/unittests/mock_base.py Extends tag mocks with values.
tests/unittests/dto/test_tag_dto.py Tests tag value serialization and equality.
tests/unittests/dto/requests/test_tags_associate_request.py Tests assignment request DTOs.
tests/unittests/dto/requests/test_tag_create_request.py Tests allowed-value serialization.
tests/unittests/client/test_metadata_object_tag_operations.py Tests legacy and value-based requests.
gravitino/dto/tag_dto.py Adds allowed and assignment values.
gravitino/dto/requests/tag_create_request.py Adds allowed-value request validation.
gravitino/dto/requests/tag_associate_request.py Adds name and value-pair requests.
gravitino/dto/requests/__init__.py Exports new request DTOs.
gravitino/client/relational_table.py Exposes tag assignment.
gravitino/client/metadata_object_tag_operations.py Implements versioned value assignment.
gravitino/client/gravitino_metalake.py Passes allowed values during creation.
gravitino/client/gravitino_client.py Exposes allowed-value creation.
gravitino/client/generic_view.py Exposes tag assignment.
gravitino/client/generic_tag.py Exposes values and filtered lookup.
gravitino/client/generic_schema.py Exposes tag assignment.
gravitino/client/generic_model.py Exposes tag assignment.
gravitino/client/generic_function.py Exposes tag assignment.
gravitino/client/generic_fileset.py Exposes tag assignment.
gravitino/client/generic_column.py Exposes tag assignment.
gravitino/client/base_schema_catalog.py Exposes tag assignment.
gravitino/api/tag/tag.py Extends the public tag API.
gravitino/api/tag/tag_operations.py Adds allowed-value creation parameter.
gravitino/api/tag/supports_tags.py Adds the assignment API contract.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +89 to +90
bool(self._tags_to_add) or bool(self._tags_to_remove),
"tagsToAdd and tagsToRemove cannot both be null or empty",
Comment on lines +141 to +142
self._validate_pairs(self._tags_to_add, "tagsToAdd")
self._validate_pairs(self._tags_to_remove, "tagsToRemove")
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.

[FEATURE] Support tag assignment values in Python client

2 participants