gravitino.dto.rel.column_dto.ColumnDTO

class gravitino.dto.rel.column_dto.ColumnDTO(_name: str, _data_type: ~gravitino.api.types.type.Type, _comment: str, _default_value: ~gravitino.api.expressions.expression.Expression | ~typing.List[~gravitino.api.expressions.expression.Expression] | None = <factory>, _nullable: bool = True, _auto_increment: bool = False)

Bases: Column, DataClassJsonMixin

Represents a Model DTO (Data Transfer Object).

__init__(_name: str, _data_type: ~gravitino.api.types.type.Type, _comment: str, _default_value: ~gravitino.api.expressions.expression.Expression | ~typing.List[~gravitino.api.expressions.expression.Expression] | None = <factory>, _nullable: bool = True, _auto_increment: bool = False) None

Methods

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

auto_increment()

Indicate if this column is an auto-increment column.

builder()

comment()

Get the comment of this column.

data_type()

Get the name of this column.

default_value()

Get the default value of this column

from_dict(kvs, *[, infer_missing])

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

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.

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

supports_tags()

Return the SupportsTags if the column supports tag operations.

to_dict([encode_json])

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

validate()

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.

dataclass_json_config

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

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

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 | List[Expression]

Get the default value of this column

Returns:
Expression:

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

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.