gravitino.api.tag.supports_tags.SupportsTags

class gravitino.api.tag.supports_tags.SupportsTags

Bases: ABC

Interface for supporting getting or associate tags to objects.

This interface will be mixed with metadata objects to provide tag operations.

__init__()

Methods

__init__()

associate_tags(tags_to_add, tags_to_remove)

Associate tags to the specific object.

get_tag(name)

Get a tag by its name for the specific object.

list_tags()

List all the tag names for the specific object.

list_tags_info()

List all the tags with details for the specific object.

abstract associate_tags(tags_to_add: List[str], tags_to_remove: List[str]) List[str]

Associate tags to the specific object.

The tags_to_add will be added to the object, and the tags_to_remove will be removed from the object.

Note that: 1. Adding or removing tags that are not existed will be ignored. 2. If the same name tag is in both tags_to_add and tags_to_remove, it will be ignored. 3. If the tag is already associated with the object, it will raise TagAlreadyAssociatedException.

Args:

tags_to_add (List[str]): The arrays of tag name to be added to the object. tags_to_remove (List[str]): The array of tag name to be removed from the object.

Raises:

TagAlreadyAssociatedException: If the tag is already associated with the object.

Returns:

List[str]: The array of tag names that are associated with the object.

abstract get_tag(name: str) Tag

Get a tag by its name for the specific object.

Args:

name (str): The name of the tag.

Raises:

NoSuchTagException: If the tag does not associate with the object.

Returns:

Tag: The tag.

abstract list_tags() List[str]

List all the tag names for the specific object.

Returns:

List[str]: The list of tag names.

abstract list_tags_info() List[Tag]

List all the tags with details for the specific object.

Returns:

List[Tag]: The list of tags.