gravitino.dto.tag_dto.TagDTO

class gravitino.dto.tag_dto.TagDTO(_name: str, _comment: str, _properties: dict[str, str], _audit: AuditDTO = None, _inherited: bool | None = None)

Bases: Tag

Represents a Tag Data Transfer Object (DTO).

__init__(_name: str, _comment: str, _properties: dict[str, str], _audit: AuditDTO = None, _inherited: bool | None = None) None

Methods

__init__(_name, _comment, _properties[, ...])

associated_objects()

The associated objects of the tag.

audit_info()

Get the audit information of the tag.

builder()

comment()

Get the comment of the tag.

from_dict(kvs, *[, infer_missing])

from_json(s, *[, parse_float, parse_int, ...])

inherited()

Check if the tag is inherited from a parent object or not.

name()

Get the name of the tag.

properties()

Get the properties of the tag.

schema(*[, infer_missing, only, exclude, ...])

to_dict([encode_json])

to_json(*[, skipkeys, ensure_ascii, ...])

Attributes

PROPERTY_COLOR

A reserved property to specify the color of the tag.

class AssociatedObjects

Bases: ABC

The interface of the associated objects of the tag.

count() int

Retrieve the number of objects that are associated with this Tag

Returns:

int: The number of objects that are associated with this Tag

abstract objects() list[gravitino.api.metadata_object.MetadataObject]

Retrieve the list of objects that are associated with this tag.

Raises:

NotImplementedError: if the method is not implemented.

Returns:

list[MetadataObject]: The list of objects that are associated with this tag.

class Builder

Bases: object

Helper class to build a TagDTO object.

PROPERTY_COLOR: ClassVar[str] = 'color'

A reserved property to specify the color of the tag. The color is a string of hex code that represents the color of the tag. The color is used to visually distinguish the tag from other tags.

associated_objects() AssociatedObjects

The associated objects of the tag.

Raises:

UnsupportedOperationException: The associated_objects method is not supported.

Returns:

AssociatedObjects: The associated objects of the tag.

audit_info() AuditDTO

Get the audit information of the tag.

Returns:

AuditDTO: The audit information of the tag.

comment() str

Get the comment of the tag.

Returns:

str: The comment of the tag.

inherited() bool | None

Check if the tag is inherited from a parent object or not.

If the tag is inherited, it will return True, if it is owned by the object itself, it will return False.

Note. The return value is optional, only when the tag is associated with an object, and called from the object, the return value will be present. Otherwise, it will be empty.

Returns:
Optional[bool]:

True if the tag is inherited, false if it is owned by the object itself. Empty if the tag is not associated with any object.

name() str

Get the name of the tag.

Returns:

str: The name of the tag.

properties() dict[str, str]

Get the properties of the tag.

Returns:

dict[str, str]: The properties of the tag.