gravitino.client.generic_column.GenericColumn

class gravitino.client.generic_column.GenericColumn(column: Column, rest_client: HTTPClient, metalake: str, catalog: str, schema: str, table: str)

Bases: Column, SupportsTags

Represents a generic column.

__init__(column: Column, rest_client: HTTPClient, metalake: str, catalog: str, schema: str, table: str)

Methods

__init__(column, rest_client, metalake, ...)

associate_tags(tags_to_add, tags_to_remove)

Associate tags to the specific object.

auto_increment()

Indicate if this column is an auto-increment column.

comment()

Get the comment of this column.

data_type()

Get the name of this column.

default_value()

Get the default value of this column

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

Get the name of this column.

nullable()

Indicate if this column may produce null values.

of(name, data_type[, comment, nullable, ...])

Create a Column instance.

supports_tags()

Return the SupportsTags if the column supports tag operations.

Attributes

DEFAULT_VALUE_NOT_SET

A default value that indicates the default value is not set.

DEFAULT_VALUE_OF_CURRENT_TIMESTAMP

A default value that indicates the default value will be set to the current timestamp.

DEFAULT_VALUE_NOT_SET = []

A default value that indicates the default value is not set. This is used in default_value()

DEFAULT_VALUE_OF_CURRENT_TIMESTAMP: Expression = <gravitino.api.rel.expressions.function_expression.FuncExpressionImpl object>

A default value that indicates the default value will be set to the current timestamp. This is used in default_value()

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.

auto_increment() bool

Indicate if this column is an auto-increment column.

Returns:

bool: True if this column is an auto-increment column. Default is False.

comment() str | None

Get the comment of this column.

Returns:

Optional[str]: The comment of this column, None if not specified.

data_type() Type

Get the name of this column.

Returns:

Type: The data type of this column.

default_value() Expression

Get the default value of this column

Returns:
Expression:

The default value of this column, Column.DEFAULT_VALUE_NOT_SET if not specified.

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

Get the name of this column.

Returns:

str: The name of this column.

nullable() bool

Indicate if this column may produce null values.

Returns:

bool: True if this column may produce null values. Default is True.

static of(name: str, data_type: Type, comment: str | None = None, nullable: bool = True, auto_increment: bool = False, default_value: Expression | None = None) ColumnImpl

Create a Column instance.

Args:
name (str):

The name of the column.

data_type (Type):

The data type of the column.

comment (Optional[str], optional):

The comment of the column. Defaults to None.

nullable (bool, optional):

True if the column may produce null values. Defaults to True.

auto_increment (bool, optional):

True if the column is an auto-increment column. Defaults to False.

default_value (Optional[Expression], optional):

The default value of this column, Column.DEFAULT_VALUE_NOT_SET if None. Defaults to None.

Returns:

ColumnImpl: A Column instance.

supports_tags() SupportsTags

Return the SupportsTags if the column supports tag operations.

Raises:

UnsupportedOperationException: if the column does not support tag operations.

Returns:

SupportsTags: the SupportsTags if the column supports tag operations.