Column
Classes
|
Check whether the columns exist in the database. |
Check whether columns have a data type configured in their properties. |
|
|
Check whether columns have an expected name based on their data type. |
|
Check whether the data type configured in a column's properties matches the data type in the database. |
|
Check whether the descriptions configured in columns' properties match the descriptions in the database. |
|
Check whether the index position within the properties of a column's table matches the index position in the database. |
|
Check whether columns have an appropriate number of tests configured. |
- class dbt_contracts.contracts.terms.column.ColumnContractTerm
Bases:
ChildContractTerm,Generic
- class dbt_contracts.contracts.terms.column.Exists
Bases:
ColumnContractTerm,GenericCheck whether the columns exist in the database.
- needs_catalog: ClassVar[bool] = True
Mark if this term requires a loaded catalog to operate. The catalog must then be provided by the ContractContext for the term to execute successfully.
- run(item: ItemT, context: ContractContext, parent: ParentT = None) bool
Validate the context before running the term.
- class dbt_contracts.contracts.terms.column.HasTests(*, min_count: Annotated[int, Ge(ge=1)] = 1, max_count: Annotated[int | None, Gt(gt=0)] = None)
Bases:
ColumnContractTerm,RangeMatcher,GenericCheck whether columns have an appropriate number of tests configured.
- needs_manifest: ClassVar[bool] = True
Mark if this term requires a loaded manifest to operate. The manifest must then be provided by the ContractContext for the term to execute successfully.
- run(item: ItemT, context: ContractContext, parent: ParentT = None) bool
Validate the context before running the term.
- class dbt_contracts.contracts.terms.column.HasExpectedName(*, ignore_whitespace: bool = False, case_insensitive: bool = False, compare_start_only: bool = False, patterns: ~collections.abc.Mapping[str | None, ~collections.abc.Sequence[str]] = <factory>)
Bases:
ColumnContractTerm,StringMatcher,GenericCheck whether columns have an expected name based on their data type. Matches the column names against a set of patterns mapped to specific data types.
- patterns: Mapping[str | None, Sequence[str]]
- classmethod make_pattern_values_tuple(patterns: Mapping[str | None, str | Sequence[str]]) dict[str | None, tuple[str]]
Convert all meta values to tuples
- run(item: ItemT, context: ContractContext, parent: ParentT = None) bool
Validate the context before running the term.
- class dbt_contracts.contracts.terms.column.HasDataType
Bases:
ColumnContractTerm,GenericCheck whether columns have a data type configured in their properties.
- run(item: ItemT, context: ContractContext, parent: ParentT = None) bool
Validate the context before running the term.
- class dbt_contracts.contracts.terms.column.HasMatchingDescription(*, ignore_whitespace: bool = False, case_insensitive: bool = False, compare_start_only: bool = False)
Bases:
ColumnContractTerm,StringMatcher,GenericCheck whether the descriptions configured in columns’ properties match the descriptions in the database.
- needs_catalog: ClassVar[bool] = True
Mark if this term requires a loaded catalog to operate. The catalog must then be provided by the ContractContext for the term to execute successfully.
- run(item: ItemT, context: ContractContext, parent: ParentT = None) bool
Validate the context before running the term.
- class dbt_contracts.contracts.terms.column.HasMatchingDataType(*, ignore_whitespace: bool = False, case_insensitive: bool = False, compare_start_only: bool = False)
Bases:
ColumnContractTerm,StringMatcher,GenericCheck whether the data type configured in a column’s properties matches the data type in the database.
- needs_catalog: ClassVar[bool] = True
Mark if this term requires a loaded catalog to operate. The catalog must then be provided by the ContractContext for the term to execute successfully.
- run(item: ItemT, context: ContractContext, parent: ParentT = None) bool
Validate the context before running the term.
- class dbt_contracts.contracts.terms.column.HasMatchingIndex(*, ignore_whitespace: bool = False, case_insensitive: bool = False, compare_start_only: bool = False)
Bases:
ColumnContractTerm,StringMatcher,GenericCheck whether the index position within the properties of a column’s table matches the index position in the database.
- needs_catalog: ClassVar[bool] = True
Mark if this term requires a loaded catalog to operate. The catalog must then be provided by the ContractContext for the term to execute successfully.
- run(item: ItemT, context: ContractContext, parent: ParentT = None) bool
Validate the context before running the term.