Column#

class etl_entities.source.db.column.Column(*, name: ColumnName, partition: OrderedDict[ColumnName, ColumnName] = None)#

DB column representation

Parameters:
namestr

Table name

Warning

Cannot contain symbols |, /, =, @ and #

partitioncollections.OrderedDict, default: empty dict

Partition which column belong to, e.g. partcolumn=value1/partcolumn2=value2

Warning

Names and values cannot contain symbols |, /, =, @ and #

Examples

from etl_entities import Column

column1 = Column(name="mycolumn")
column2 = Column(
    name="mycolumn", partition={"partcolumn": "value1", "partcolumn2": "value2"}
)
Attributes:
qualified_name

Unique name of column

Methods

copy(*[, include, exclude, update, deep])

Duplicate a model, optionally choose which fields to include, exclude and change.

dict(*[, include, exclude, by_alias, ...])

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

json(*[, include, exclude, by_alias, ...])

Generate a JSON representation of the model, include and exclude arguments as per dict().

__str__()#

Returns column name

copy(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, update: DictStrAny | None = None, deep: bool = False) Model#

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters:
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns:

new model instance

dict(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, by_alias: bool = False, skip_defaults: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) DictStrAny#

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

json(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, by_alias: bool = False, skip_defaults: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Callable[[Any], Any] | None = None, models_as_dict: bool = True, **dumps_kwargs: Any) unicode#

Generate a JSON representation of the model, include and exclude arguments as per dict().

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().

property qualified_name: str#

Unique name of column

Returns:
valuestr

Qualified name

Examples

from etl_entities import Table

column1 = Column(name="mycolumn")
column2 = Column(
    name="mycolumn", partition={"partcolumn": "value1", "partcolumn2": "value2"}
)

assert column1.qualified_name == "mycolumn"
assert column2.qualified_name == "mycolumn|partcolumn1=value1/partcolumn2=value2"