gravitino.client.relational_table.RelationalTable

class gravitino.client.relational_table.RelationalTable(namespace: Namespace, table_dto: TableDTO, rest_client: HTTPClient)

Bases: Table, SupportsStatistics, SupportsTags

Represents a relational table.

__init__(namespace: Namespace, table_dto: TableDTO, rest_client: HTTPClient)

Methods

__init__(namespace, table_dto, rest_client)

add_partition(partition)

Adds a partition to the table.

associate_tags(tags_to_add, tags_to_remove)

Associate tags to the specific object.

audit_info()

columns()

Gets the columns of the table.

comment()

Gets the comment of the table.

distribution()

Gets the bucketing of the table.

drop_partition(partition_name)

Drops the partition with the given name.

drop_statistics(statistics)

Drop statistics by their names.

get_partition(partition_name)

Returns the partition with the given name.

get_tag(name)

Get a tag by its name for the specific object.

index()

Gets the indexes of the table.

list_partition_names()

Get the partition names of the table.

list_partitions()

Get the partitions of the table.

list_statistics()

Lists all statistics.

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()

Gets name of the table.

partitioning()

Gets the physical partitioning of the table.

properties()

Gets the properties of the table.

sort_order()

Gets the sort order of the table.

supports_statistics()

supports_tags()

table_full_name(table_ns, table_name)

update_statistics(statistics)

Updates statistics with the provided values.

add_partition(partition: Partition) Partition

Adds a partition to the table.

Args:

partition (Partition): The partition to add.

Returns:

Partition: The added partition.

Raises:
PartitionAlreadyExistsException:

if the partition already exists, throws this exception.

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]

Gets the columns of the table.

Returns:

list[Column]: The columns of the table.

comment() str | None

Gets the comment of the table.

Returns:
str (optional):

The comment of the table. None is returned if no comment is set.

distribution() Distribution

Gets the bucketing of the table.

Returns:
Distribution:

The bucketing of the table. If no bucketing is specified, Distribution.NONE is returned.

drop_partition(partition_name: str) bool

Drops the partition with the given name.

Args:

partition_name (str): The name of the partition.

Returns:

bool: True if the partition is dropped, False if the partition does not exist.

drop_statistics(statistics: list[str]) bool

Drop statistics by their names.

If the statistic is unmodifiable, it will throw an UnmodifiableStatisticException.

Args:

statistics: a list of statistic names to be dropped

Returns:
bool:

True if the statistics were successfully dropped, False if no statistics were dropped

Raises:
UnmodifiableStatisticException:

if any of the statistics to be dropped are unmodifiable

get_partition(partition_name: str) Partition

Returns the partition with the given name.

Args:

partition_name (str): the name of the partition

Returns:

Partition: the partition with the given name

Raises:
NoSuchPartitionException:

if the partition does not exist, throws this exception.

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.

index() list[gravitino.api.rel.indexes.index.Index]

Gets the indexes of the table.

Returns:
list[Index]:

The indexes of the table. If no indexes are specified, Indexes.EMPTY_INDEXES is returned.

list_partition_names() list[str]

Get the partition names of the table.

Returns:

list[str]: The partition names of the table.

list_partitions() list[gravitino.api.rel.partitions.partition.Partition]

Get the partitions of the table.

Returns:

list[Partition]: The partitions of the table.

list_statistics() list[gravitino.api.stats.statistic.Statistic]

Lists all statistics.

Returns:

A list of statistics

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

Gets name of the table.

Returns:

str: Name of the table.

partitioning() list[gravitino.api.rel.expressions.transforms.transform.Transform]

Gets the physical partitioning of the table.

Returns:

list[Transform]: The physical partitioning of the table.

properties() dict[str, str]

Gets the properties of the table.

Returns:
dict[str, str]:

The properties of the table. Empty dictionary is returned if no properties are set.

sort_order() list[gravitino.api.rel.expressions.sorts.sort_order.SortOrder]

Gets the sort order of the table.

Returns:
list[SortOrder]:

The sort order of the table. If no sort order is specified, an empty list is returned.

update_statistics(statistics: dict[str, gravitino.api.stats.statistic_value.StatisticValue[Any]]) None

Updates statistics with the provided values.

If the statistic exists, it will be updated with the new value. If the statistic does not exist, it will be created. If the statistic is unmodifiable, it will throw an UnmodifiableStatisticException. If the statistic name is illegal, it will throw an IllegalStatisticNameException.

Args:

statistics: a map of statistic names to their values

Raises:

IllegalStatisticNameException: If the statistic name is illegal UnmodifiableStatisticException: If the statistic is unmodifiable