gravitino.client.generic_view.GenericView

class gravitino.client.generic_view.GenericView(view_dto: ViewDTO, rest_client: HTTPClient, view_namespace: Namespace)

Bases: View, SupportsTags

A generic implementation of the View interface.

__init__(view_dto: ViewDTO, rest_client: HTTPClient, view_namespace: Namespace)

Create a GenericView from a ViewDTO.

Args:

view_dto: The view DTO. rest_client: The REST client for tag operations. view_namespace: The full view namespace in metalake.catalog.schema format.

Methods

__init__(view_dto, rest_client, view_namespace)

Create a GenericView from a ViewDTO.

associate_tags(tags_to_add, tags_to_remove)

Associate tags to the specific object.

audit_info()

columns()

Returns the output columns of the view.

comment()

Returns the view comment.

default_catalog()

Returns the default catalog used to resolve unqualified identifiers.

default_schema()

Returns the default schema used to resolve unqualified identifiers.

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.

name()

Returns the view name.

properties()

Returns the view properties.

representations()

Returns the representations of the view.

sql_for(dialect)

Returns the SQL representation for the given dialect.

supports_tags()

Return tag operations if the view supports tags.

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.

columns() → list[gravitino.api.rel.column.Column]

Returns the output columns of the view.

comment() → str | None

Returns the view comment.

default_catalog() → str | None

Returns the default catalog used to resolve unqualified identifiers.

default_schema() → str | None

Returns the default schema used to resolve unqualified identifiers.

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.

list_tags() → list[str]

List all the tag names for the specific object.

Returns:

list[str]: The list of tag names.

list_tags_info() → list[gravitino.api.tag.tag.Tag]

List all the tags with details for the specific object.

Returns:

list[Tag]: The list of tags.

name() → str

Returns the view name.

properties() → dict[str, str]

Returns the view properties.

representations() → list[gravitino.api.rel.representation.Representation]

Returns the representations of the view.

sql_for(dialect: str | None) → SQLRepresentation | None

Returns the SQL representation for the given dialect.

supports_tags() → SupportsTags

Return tag operations if the view supports tags.

Raises:

UnsupportedOperationException: If the view does not support tag operations.

Returns:

SupportsTags: The tag operations supported by the view.