Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions clients/client-python/gravitino/api/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from gravitino.api.auditable import Auditable
from gravitino.api.supports_schemas import SupportsSchemas
from gravitino.api.tag.supports_tags import SupportsTags


class Catalog(Auditable):
Expand Down Expand Up @@ -179,7 +180,7 @@ def as_topic_catalog(self) -> "TopicCatalog": # noqa: F821
"""
raise UnsupportedOperationException("Catalog does not support topic operations")

def as_model_catalog(self) -> "ModelCatalog": # noqa: F821
def as_model_catalog(self) -> "GenericModelCatalog":
"""
Returns:
the {@link ModelCatalog} if the catalog supports model operations.
Expand All @@ -189,7 +190,7 @@ def as_model_catalog(self) -> "ModelCatalog": # noqa: F821
"""
raise UnsupportedOperationException("Catalog does not support model operations")

def as_function_catalog(self) -> "FunctionCatalog": # noqa: F821
def as_function_catalog(self) -> "FunctionCatalog":
"""
Returns:
the {@link FunctionCatalog} if the catalog supports function operations.
Expand All @@ -201,6 +202,18 @@ def as_function_catalog(self) -> "FunctionCatalog": # noqa: F821
"Catalog does not support function operations"
)

def supports_tags(self) -> SupportsTags:
"""
Return the {@link SupportsTags} if the catalog supports tag operations.

Raises:
UnsupportedOperationException: if the catalog does not support tag operations.

Returns:
SupportsTags: the {@link SupportsTags} instance
"""
raise UnsupportedOperationException("Catalog does not support tag operations")


class UnsupportedOperationException(Exception):
pass
7 changes: 6 additions & 1 deletion clients/client-python/gravitino/api/file/fileset.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

from abc import abstractmethod
from enum import Enum
from typing import Optional, Dict
from typing import Dict, Optional

from gravitino.api.auditable import Auditable
from gravitino.api.tag.supports_tags import SupportsTags
from gravitino.exceptions.base import UnsupportedOperationException


class Fileset(Auditable):
Expand Down Expand Up @@ -209,3 +211,6 @@ def properties(self) -> Dict[str, str]:
The properties of the fileset object. Empty map is returned if no properties are set.
"""
pass

def supports_tags(self) -> SupportsTags:
raise UnsupportedOperationException("Table does not support tag operations.")
7 changes: 6 additions & 1 deletion clients/client-python/gravitino/api/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
# specific language governing permissions and limitations
# under the License.

from typing import Dict, Optional
from abc import abstractmethod
from typing import Dict, Optional

from gravitino.api.auditable import Auditable
from gravitino.api.tag.supports_tags import SupportsTags
from gravitino.exceptions.base import UnsupportedOperationException


class Model(Auditable):
Expand Down Expand Up @@ -72,3 +74,6 @@ def latest_version(self) -> int:
The latest version of the model object.
"""
pass

def supports_tags(self) -> SupportsTags:
raise UnsupportedOperationException("Table does not support tag operations.")
5 changes: 5 additions & 0 deletions clients/client-python/gravitino/api/rel/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
from gravitino.api.rel.expressions.transforms.transforms import Transforms
from gravitino.api.rel.indexes.index import Index
from gravitino.api.rel.indexes.indexes import Indexes
from gravitino.api.tag.supports_tags import SupportsTags
from gravitino.exceptions.base import UnsupportedOperationException


class Table(Auditable):
Expand Down Expand Up @@ -110,3 +112,6 @@ def properties(self) -> dict[str, str]:
"""

return {}

def supports_tags(self) -> SupportsTags:
raise UnsupportedOperationException("Table does not support tag operations.")
7 changes: 6 additions & 1 deletion clients/client-python/gravitino/api/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
# under the License.

from abc import abstractmethod
from typing import Optional, Dict
from typing import Dict, Optional

from gravitino.api.auditable import Auditable
from gravitino.api.tag.supports_tags import SupportsTags
from gravitino.exceptions.base import UnsupportedOperationException


class Schema(Auditable):
Expand All @@ -43,3 +45,6 @@ def comment(self) -> Optional[str]:
def properties(self) -> Dict[str, str]:
"""Returns the properties of the Schema. An empty dictionary is returned if no properties are set."""
return {}

def supports_tags(self) -> SupportsTags:
raise UnsupportedOperationException("Table does not support tag operations.")
3 changes: 3 additions & 0 deletions clients/client-python/gravitino/client/base_schema_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,3 +352,6 @@ def associate_tags(
self, tags_to_add: List[str], tags_to_remove: List[str]
) -> List[str]:
return self._object_tag_operations.associate_tags(tags_to_add, tags_to_remove)

def supports_tags(self) -> SupportsTags:
return self
3 changes: 3 additions & 0 deletions clients/client-python/gravitino/client/generic_fileset.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ def audit_info(self) -> AuditDTO:
def support_credentials(self) -> SupportsCredentials:
return self

def supports_tags(self) -> SupportsTags:
return self

def get_credentials(self) -> List[Credential]:
return self._object_credential_operations.get_credentials()

Expand Down
3 changes: 3 additions & 0 deletions clients/client-python/gravitino/client/generic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,6 @@ def associate_tags(
self, tags_to_add: list[str], tags_to_remove: list[str]
) -> list[str]:
return self._model_tag_operations.associate_tags(tags_to_add, tags_to_remove)

def supports_tags(self) -> SupportsTags:
return self
3 changes: 3 additions & 0 deletions clients/client-python/gravitino/client/generic_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,6 @@ def associate_tags(
return self._metadata_object_tag_operations.associate_tags(
tags_to_add, tags_to_remove
)

def supports_tags(self) -> SupportsTags:
return self
9 changes: 6 additions & 3 deletions clients/client-python/gravitino/client/relational_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ def add_partition(self, partition: Partition) -> Partition:
if the partition already exists, throws this exception.
"""

req = AddPartitionsRequest(
[cast(PartitionDTO, DTOConverters.to_dto(partition))]
)
req = AddPartitionsRequest([
cast(PartitionDTO, DTOConverters.to_dto(partition))
])
req.validate()

resp = self._rest_client.post(
Expand All @@ -246,3 +246,6 @@ def associate_tags(
self, tags_to_add: list[str], tags_to_remove: list[str]
) -> list[str]:
return self._object_tag_operations.associate_tags(tags_to_add, tags_to_remove)

def supports_tags(self) -> SupportsTags:
return self
Loading
Loading