Node

Inheritance diagram of dbt_contracts.contracts.generators.node.NodePropertiesGenerator, dbt_contracts.contracts.generators.node.NodePropertyGenerator, dbt_contracts.contracts.generators.node.SetNodeColumns, dbt_contracts.contracts.generators.node.SetNodeDescription

Classes

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

NodePropertyGenerator(*[, overwrite])

SetNodeColumns(*[, overwrite, add, remove, ...])

SetNodeDescription(*[, overwrite, terminator])

class dbt_contracts.contracts.generators.node.NodePropertyGenerator(*, overwrite: bool = True)

Bases: PropertyGenerator, Generic

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

Bases: SetDescription, NodePropertyGenerator, Generic

run(source: S, target: CatalogTable) → 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.node.SetNodeColumns(*, overwrite: bool = True, add: bool = True, remove: bool = True, order: bool = True)

Bases: NodePropertyGenerator, Generic

add: bool
remove: bool
order: bool
run(source: S, target: CatalogTable) → 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.node.NodePropertiesGenerator(*, exclude: Annotated[Sequence[Literal['description', 'columns']], BeforeValidator(func=to_tuple, json_schema_input_type=PydanticUndefined)] = (), filename: str = '_config.yml', depth: Annotated[int | None, Ge(ge=0)] = None, description: SetNodeDescription = SetNodeDescription(overwrite=True, terminator=None), columns: SetNodeColumns = SetNodeColumns(overwrite=True, add=True, remove=True, order=True))

Bases: ParentPropertiesGenerator

exclude: Annotated[Sequence[Literal['description', 'columns']], BeforeValidator(func=to_tuple, json_schema_input_type=PydanticUndefined)]
description: SetNodeDescription
columns: SetNodeColumns
merge(item: NodeT, context: ContractContext) → 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.

Returns:

Whether the properties of the item were modified.

model_post_init(context: Any, /) → None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.