You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "kevinw66 (via GitHub)" <gi...@apache.org> on 2026/08/14 07:08:41 UTC

[PR] [#12464] improvement(client-python): Support metadata object role operations [gravitino]

kevinw66 opened a new pull request, #12465:
URL: https://github.com/apache/gravitino/pull/12465

   ### What changes were proposed in this pull request?
   
   Add metadata object role operations to the Python client.
   
   This change:
   
   - Adds `supports_roles()` to metalake, catalog, schema, table, fileset, and model APIs.
   - Supports listing directly bound role names for metalakes, catalogs, schemas, tables, and filesets.
   - Adds view and function helpers to `SecurableObjects`.
   - Adds unit and integration test coverage.
   
   ### Why are the changes needed?
   
   The Java client exposes role operations through metadata objects, but the Python client does not provide the equivalent API. This change brings the Python client into alignment with the Java client.
   
   Fix: #12464
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Python client users can call:
   
   ```python
   metadata_object.supports_roles().list_binding_role_names()
   ```
   
   The Python client also provides `SecurableObjects.of_view()` and `SecurableObjects.of_function()`.
   
   ### How was this patch tested?
   
   Added unit tests for the public APIs, client implementations, and securable object helpers.
   
   Added an integration test covering role bindings for metalakes, catalogs, schemas, tables, and filesets.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12464] improvement(client-python): Support metadata object role operations [gravitino]

Posted by "jerryshao (via GitHub)" <gi...@apache.org>.
jerryshao commented on code in PR #12465:
URL: https://github.com/apache/gravitino/pull/12465#discussion_r3841123585


##########
clients/client-python/gravitino/client/base_schema_catalog.py:
##########
@@ -19,6 +19,7 @@
 from typing import Dict, List, Optional
 
 from gravitino.api.catalog import Catalog
+from gravitino.api.authorization.supports_roles import SupportsRoles

Review Comment:
   **[Minor]** This new import is inserted right after `from gravitino.api.catalog import Catalog`, breaking alphabetical import order (`authorization.supports_roles` sorts before `catalog`).
   
   Every other file touched by this same PR (`generic_fileset.py`, `generic_model.py`, `generic_schema.py`, `gravitino_metalake.py`, `relational_table.py`) places the new `authorization.supports_roles` import alphabetically correctly. Worth moving this one up to match, for consistency.



##########
clients/client-python/gravitino/api/catalog.py:
##########
@@ -224,6 +225,17 @@ def supports_tags(self) -> SupportsTags:
         """
         raise UnsupportedOperationException("Catalog does not support tag operations")
 
+    def supports_roles(self) -> SupportsRoles:
+        """Return role operations supported by this catalog.
+
+        Returns:
+            SupportsRoles: The role operations supported by this catalog.
+
+        Raises:
+            UnsupportedOperationException: If this catalog does not support role operations.
+        """
+        raise UnsupportedOperationException("Catalog does not support role operations")

Review Comment:
   **[Confirmed bug]** This raises the locally-defined `UnsupportedOperationException(Exception)` from the bottom of this file, not `gravitino.exceptions.base.UnsupportedOperationException` used by every sibling default (`Metalake`, `Schema`, `Table`, `Fileset`, `Model`).
   
   Code written to catch the standard `gravitino.exceptions.base.UnsupportedOperationException` around a generic `metadata_object.supports_roles()` call (to detect "role ops unsupported" uniformly across metalakes/catalogs/schemas/tables/filesets) will not catch it for a `Catalog` whose `supports_roles()` falls through to this default, since the two `UnsupportedOperationException` classes are unrelated hierarchies (`Exception` vs `GravitinoRuntimeException`). This PR's own unit test (`tests/unittests/test_supports_roles.py`) has to alias-import `UnsupportedOperationException as CatalogUnsupportedOperationException` specifically to work around this, confirming the divergence is real. Currently latent since all concrete catalogs go through `BaseSchemaCatalog`'s override, but any future/third-party `Catalog` subclass that doesn't extend `BaseSchemaCatalog` will hit it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12464] improvement(client-python): Support metadata object role operations [gravitino]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #12465:
URL: https://github.com/apache/gravitino/pull/12465#issuecomment-5291345221

   <!-- coverage-report -->
   ### Code Coverage Report
   |Overall Project|68.67%|:green_circle:|
   |:-|:-|:-:|
   |Files changed|No Java source files changed|-|
   <br>
   
   |Module|Coverage||
   |:-|:-|:-:|
   |aliyun|1.72%|:red_circle:|
   |api|49.31%|:green_circle:|
   |authorization-common|85.96%|:green_circle:|
   |aws|42.04%|:green_circle:|
   |azure|2.47%|:red_circle:|
   |catalog-common|9.92%|:red_circle:|
   |catalog-fileset|79.77%|:green_circle:|
   |catalog-glue|68.95%|:green_circle:|
   |catalog-hive|79.4%|:green_circle:|
   |catalog-jdbc-common|45.7%|:green_circle:|
   |catalog-jdbc-doris|81.8%|:green_circle:|
   |catalog-jdbc-mysql|79.33%|:green_circle:|
   |catalog-jdbc-postgresql|83.39%|:green_circle:|
   |catalog-jdbc-starrocks|79.16%|:green_circle:|
   |catalog-kafka|77.01%|:green_circle:|
   |catalog-lakehouse-generic|59.18%|:green_circle:|
   |catalog-lakehouse-hudi|79.1%|:green_circle:|
   |catalog-lakehouse-iceberg|85.86%|:green_circle:|
   |catalog-lakehouse-paimon|84.23%|:green_circle:|
   |catalog-model|77.72%|:green_circle:|
   |cli|44.48%|:green_circle:|
   |client-java|78.56%|:green_circle:|
   |common|52.75%|:green_circle:|
   |core|83.63%|:green_circle:|
   |filesystem-hadoop3|77.28%|:green_circle:|
   |flink|0.0%|:red_circle:|
   |flink-common|48.68%|:green_circle:|
   |flink-runtime|0.0%|:red_circle:|
   |gcp|14.12%|:red_circle:|
   |hadoop-auth|68.0%|:green_circle:|
   |hadoop-common|12.7%|:red_circle:|
   |hive-metastore-common|53.4%|:green_circle:|
   |iceberg-aliyun-bundle|0.0%|:red_circle:|
   |iceberg-common|64.75%|:green_circle:|
   |iceberg-rest-server|75.03%|:green_circle:|
   |idp-basic|86.02%|:green_circle:|
   |integration-test-common|0.0%|:red_circle:|
   |jobs|62.92%|:green_circle:|
   |lance-common|31.75%|:red_circle:|
   |lance-rest-server|63.47%|:green_circle:|
   |lineage|53.02%|:green_circle:|
   |optimizer|83.17%|:green_circle:|
   |optimizer-api|21.95%|:red_circle:|
   |server|87.25%|:green_circle:|
   |server-common|79.41%|:green_circle:|
   |spark|28.57%|:red_circle:|
   |spark-common|45.89%|:green_circle:|
   |tencent|69.84%|:green_circle:|
   |trino-connector|40.29%|:green_circle:|
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12464] improvement(client-python): Support metadata object role operations [gravitino]

Posted by "jerryshao (via GitHub)" <gi...@apache.org>.
jerryshao commented on PR #12465:
URL: https://github.com/apache/gravitino/pull/12465#issuecomment-5394378938

   @kevinw66 Can you fix the merge conflict?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12464] improvement(client-python): Support metadata object role operations [gravitino]

Posted by "kevinw66 (via GitHub)" <gi...@apache.org>.
kevinw66 commented on PR #12465:
URL: https://github.com/apache/gravitino/pull/12465#issuecomment-5403841952

   > @kevinw66 Can you fix the merge conflict?
   
   @jerryshao Done, thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#12464] improvement(client-python): Support metadata object role operations [gravitino]

Posted by "jerryshao (via GitHub)" <gi...@apache.org>.
jerryshao merged PR #12465:
URL: https://github.com/apache/gravitino/pull/12465


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org