Column

Inheritance diagram of dbt_contracts.contracts.generators.column.ColumnPropertiesGenerator, dbt_contracts.contracts.generators.column.ColumnPropertyGenerator, dbt_contracts.contracts.generators.column.SetColumnDescription, dbt_contracts.contracts.generators.column.SetDataType

Classes

ColumnPropertiesGenerator(*[, exclude, ...])

ColumnPropertyGenerator(*[, overwrite])

SetColumnDescription(*[, overwrite, terminator])

SetDataType(*[, overwrite])

class dbt_contracts.contracts.generators.column.ColumnPropertyGenerator(*, overwrite: bool = True)

Bases: PropertyGenerator

class dbt_contracts.contracts.generators.column.SetColumnDescription(*, overwrite: bool = True, terminator: str | None = None)

Bases: ColumnPropertyGenerator, SetDescription

run(source: ColumnInfo, target: ColumnMetadata) → bool

Run this generator on the given source, merging properties from the target item.

Parameters:
  • source – The item to modify.

  • target – The item containing the target properties to set onto the source.

Returns:

Boolean for if the source was modified.

class dbt_contracts.contracts.generators.column.SetDataType(*, overwrite: bool = True)

Bases: ColumnPropertyGenerator

run(source: ColumnInfo, target: ColumnMetadata) → bool

Run this generator on the given source, merging properties from the target item.

Parameters:
  • source – The item to modify.

  • target – The item containing the target properties to set onto the source.

Returns:

Boolean for if the source was modified.

class dbt_contracts.contracts.generators.column.ColumnPropertiesGenerator(*, exclude: Annotated[Sequence[Literal['description', 'data_type']], BeforeValidator(func=to_tuple, json_schema_input_type=PydanticUndefined)] = (), description: SetColumnDescription = SetColumnDescription(overwrite=True, terminator=None), data_type: SetDataType = SetDataType(overwrite=True))

Bases: ChildPropertiesGenerator, Generic

exclude: Annotated[Sequence[Literal['description', 'data_type']], BeforeValidator(func=to_tuple, json_schema_input_type=PydanticUndefined)]
description: SetColumnDescription
data_type: SetDataType
merge(item: ColumnInfo, context: ContractContext, parent: P = None) → bool

Merge the properties of the given item with the properties of its remote database object.

Parameters:
  • item – The item to modify properties for.

  • context – The contract context to use.

  • parent – The parent item that the given child item belongs to if available.

Returns:

Whether the properties of the item were modified.