Skip to content

[#9882] Add implementation for TagOperations in python client(part2)#10554

Open
Abyss-lord wants to merge 2 commits intoapache:mainfrom
Abyss-lord:feat-9882
Open

[#9882] Add implementation for TagOperations in python client(part2)#10554
Abyss-lord wants to merge 2 commits intoapache:mainfrom
Abyss-lord:feat-9882

Conversation

@Abyss-lord
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Add rest implementation for TagOperations in python client

Why are the changes needed?

Fix: #9882

Does this PR introduce any user-facing change?

Users can now manage tags using the GravitinoClient.

How was this patch tested?

local unittest

…art2)

Add implementation for TagOperations in python client(part2)
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 26, 2026

Code Coverage Report

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

Module Coverage
aliyun 1.73% 🔴
api 47.14% 🟢
authorization-common 85.96% 🟢
aws 1.1% 🔴
azure 2.6% 🔴
catalog-common 10.0% 🔴
catalog-fileset 80.02% 🟢
catalog-hive 80.98% 🟢
catalog-jdbc-clickhouse 79.06% 🟢
catalog-jdbc-common 42.89% 🟢
catalog-jdbc-doris 80.28% 🟢
catalog-jdbc-hologres 54.03% 🟢
catalog-jdbc-mysql 79.23% 🟢
catalog-jdbc-oceanbase 78.38% 🟢
catalog-jdbc-postgresql 82.05% 🟢
catalog-jdbc-starrocks 78.27% 🟢
catalog-kafka 77.01% 🟢
catalog-lakehouse-generic 45.07% 🟢
catalog-lakehouse-hudi 79.1% 🟢
catalog-lakehouse-iceberg 87.15% 🟢
catalog-lakehouse-paimon 77.71% 🟢
catalog-model 77.72% 🟢
cli 44.51% 🟢
client-java 77.83% 🟢
common 49.42% 🟢
core 81.13% 🟢
filesystem-hadoop3 76.97% 🟢
flink 38.86% 🔴
flink-runtime 0.0% 🔴
gcp 14.2% 🔴
hadoop-common 10.39% 🔴
hive-metastore-common 45.82% 🟢
iceberg-common 50.21% 🟢
iceberg-rest-server 66.51% 🟢
integration-test-common 0.0% 🔴
jobs 66.17% 🟢
lance-common 23.88% 🔴
lance-rest-server 57.84% 🟢
lineage 53.02% 🟢
optimizer 82.87% 🟢
optimizer-api 21.95% 🔴
server 85.62% 🟢
server-common 70.14% 🟢
spark 32.79% 🔴
spark-common 39.09% 🔴
trino-connector 31.62% 🔴

@Abyss-lord Abyss-lord self-assigned this Mar 27, 2026
@Abyss-lord Abyss-lord requested a review from tsungchih March 27, 2026 08:00
@Abyss-lord
Copy link
Copy Markdown
Contributor Author

Hi @tsungchih , could you please review this PR when you have time? I’d really appreciate your feedback.

TagUpdateRequest.UpdateTagCommentRequest,
TagUpdateRequest.SetTagPropertyRequest,
TagUpdateRequest.RemoveTagPropertyRequest,
]:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

All of the four requests are subclasses of TagUpdateRequestBase. I think we can define the return type as the base class.

if isinstance(change, TagChange.RemoveProperty):
return TagUpdateRequest.RemoveTagPropertyRequest(change.removed_property)

raise ValueError(f"Unknown change type: {type(change)}")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should raise the similar exception to the Java client, IllegalArgumentException.

raise NotImplementedError()
url = self.API_METALAKES_TAGS_PATH.format(encode_string(self.name()))

response = self.rest_client.get(url, error_handler=TAG_ERROR_HANDLER)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I didn't see that parameters are sent with the API call similar to the Java client.

public Tag[] listTagsInfo() throws NoSuchMetalakeException {
Map<String, String> params = ImmutableMap.of("details", "true");
TagListResponse resp =
restClient.get(
String.format(API_METALAKES_TAGS_PATH, RESTUtils.encodeString(this.name())),
params,
TagListResponse.class,
Collections.emptyMap(),
ErrorHandlers.tagErrorHandler());

tag_resp: TagResponse = TagResponse.from_json(response.body, infer_missing=True)
tag_resp.validate()

tag_resp.validate()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this statement, tag_resp,validate() redundant?

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] Add implementation for TagOperations in python client(part2)

2 participants