Table#

class etl_entities.source.db.table.Table(*, name: TableDBName, instance: GenericURL | Cluster)#

DB table representation

Deprecated since version 2.0.0.

Parameters:
namestr

Table name

Warning

Cannot contain ., @ and #

dbstr

Database (schema) name

Warning

Cannot contain dot symbol ., @ and #

instanceetl_entities.instance.url.generic_url.GenericURL

or etl_entities.instance.cluster.cluster.Cluster

Cluster name in format my-cluster or instance URL in format "protocol://some.domain[:port]"

Examples

from etl_entities import Table

table1 = Table(name="mydb.mytable", instance="postgres://db.host:5432")
table2 = Table(name="mydb.mytable", instance="rnd-dwh")
__str__()#

Returns full table 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) str#

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 table

Returns:
valuestr

Qualified name

Examples

from etl_entities import Table

table1 = Table(name="mydb.mytable", instance="postgres://db.host:5432")
table2 = Table(name="mydb.mytable", instance="rnd-dwh")

assert table1.qualified_name == "mydb.mytable@postgres://db.host:5432"
assert table2.qualified_name == "mydb.mytable@rnd-dwh"