gravitino.dto.util.dto_converters.DTOConverters

class gravitino.dto.util.dto_converters.DTOConverters

Bases: object

Utility class for converting between DTOs and domain objects.

__init__()

Methods

__init__()

from_dto()

from_dtos()

Converts list of ColumnDTO, IndexDTO, SortOrderDTO, or Partitioning to the corresponding list of `Column`s, `Index`es, `SortOrder`s, or `Transform`s.

from_function_arg(arg)

Converts a FunctionArg DTO to an Expression.

from_function_args(args)

Converts a FunctionArg DTO to an Expression.

to_dto()

to_dtos()

to_function_arg(expression)

Converts an Expression to an FunctionArg DTO.

to_function_args(expressions)

Converts a list of Expressions to a list of FunctionArg DTOs.

static from_dtos(dtos: list[ColumnDTO]) list[Column]
static from_dtos(dtos: list[IndexDTO]) list[Index]
static from_dtos(dtos: list[SortOrderDTO]) list[SortOrder]
static from_dtos(dtos: list[Partitioning]) list[Transform]

Converts list of ColumnDTO, IndexDTO, SortOrderDTO, or Partitioning to the corresponding list of `Column`s, `Index`es, `SortOrder`s, or `Transform`s.

Args:
dtos (list[ColumnDTO] | list[IndexDTO] | list[SortOrderDTO] | list[Partitioning]):

The DTOs to be converted.

Returns:
list[Column] | list[Index] | list[SortOrder] | list[Transform]:

The list of Columns, Indexes, SortOrders, or Transforms depends on the input DTOs.

static from_function_arg(arg: FunctionArg) Expression

Converts a FunctionArg DTO to an Expression.

Args:

arg (FunctionArg): The function argument DTO to be converted.

Returns:

Expression: The expression.

static from_function_args(args: list[gravitino.dto.rel.expressions.function_arg.FunctionArg]) list[gravitino.api.rel.expressions.expression.Expression]

Converts a FunctionArg DTO to an Expression.

Args:

args (list[FunctionArg]): The function argument DTOs to be converted.

Returns:

list[Expression]: The list of expressions.

static to_function_arg(expression: Expression) FunctionArg

Converts an Expression to an FunctionArg DTO.

Args:

expression (Expression): The expression to be converted.

Returns:

FunctionArg: The expression DTO.

static to_function_args(expressions: list[gravitino.api.rel.expressions.expression.Expression]) list[gravitino.dto.rel.expressions.function_arg.FunctionArg]

Converts a list of Expressions to a list of FunctionArg DTOs.

Args:

expressions (list[Expression]): The expressions to be converted.

Returns:

list[FunctionArg]: The list of expression DTOs.