Nodeο
Classes
|
Check whether the {kind} exist in the database. |
Check whether {kind} have all columns set in their properties. |
|
Check whether {kind} have appropriate configuration for a contract in their properties. |
|
|
Check whether {kind} have the expected names of columns set in their properties. |
|
Check whether the descriptions configured in {kind}' properties match the descriptions in the database. |
Check if {kind} have a final semicolon present in their queries. |
|
Check if {kind} have any hardcoded references to database objects in their queries. |
|
|
Check whether {kind} have an appropriate number of tests configured. |
Check whether {kind} have an appropriate number of upstream dependencies for macros i.e. the number of custom macros present in the query. |
|
Check whether {kind} have an appropriate number of upstream dependencies i.e. the number of |
|
Check whether {kind} have an appropriate number of upstream dependencies for sources i.e. the number of |
|
- class dbt_contracts.contracts.terms.node.NodeContractTermο
Bases:
ParentContractTerm,Generic
- class dbt_contracts.contracts.terms.node.Existsο
Bases:
NodeContractTerm,GenericCheck whether the {kind} 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.node.HasTests(*, min_count: Annotated[int, Ge(ge=1)] = 1, max_count: Annotated[int | None, Gt(gt=0)] = None)ο
Bases:
NodeContractTerm,RangeMatcher,GenericCheck whether {kind} 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.node.HasAllColumnsο
Bases:
NodeContractTerm,GenericCheck whether {kind} have all columns set in their properties. Ensures that all columns present in the database are present in dbt project properties.
- 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.node.HasExpectedColumns(*, columns: str | Sequence[str] | Mapping[str, str] = ())ο
Bases:
NodeContractTerm,GenericCheck whether {kind} have the expected names of columns set in their properties. Also checks if those columns have the expected data types if configured to do so.
- columns: str | Sequence[str] | Mapping[str, str]ο
- run(item: ItemT, context: ContractContext, parent: ParentT = None) boolο
Validate the context before running the term.
- class dbt_contracts.contracts.terms.node.HasMatchingDescription(*, ignore_whitespace: bool = False, case_insensitive: bool = False, compare_start_only: bool = False)ο
Bases:
NodeContractTerm,StringMatcher,GenericCheck whether the descriptions configured in {kind}β 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.node.HasContractο
Bases:
NodeContractTerm,GenericCheck whether {kind} have appropriate configuration for a contract in their properties.
- run(item: ItemT, context: ContractContext, parent: ParentT = None) boolο
Validate the context before running the term.
- class dbt_contracts.contracts.terms.node.HasValidUpstreamDependenciesο
Bases:
NodeContractTerm,Generic- 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.
- class dbt_contracts.contracts.terms.node.HasValidRefDependenciesο
Bases:
HasValidUpstreamDependencies,GenericCheck whether {kind} have an appropriate number of upstream dependencies i.e. the number of
refmacros present in the query.- run(item: ItemT, context: ContractContext, parent: ParentT = None) boolο
Validate the context before running the term.
- class dbt_contracts.contracts.terms.node.HasValidSourceDependenciesο
Bases:
HasValidUpstreamDependencies,GenericCheck whether {kind} have an appropriate number of upstream dependencies for sources i.e. the number of
sourcemacros present in the query.- run(item: ItemT, context: ContractContext, parent: ParentT = None) boolο
Validate the context before running the term.
- class dbt_contracts.contracts.terms.node.HasValidMacroDependenciesο
Bases:
HasValidUpstreamDependencies,GenericCheck whether {kind} have an appropriate number of upstream dependencies for macros i.e. the number of custom macros present in the query.
- run(item: ItemT, context: ContractContext, parent: ParentT = None) boolο
Validate the context before running the term.
- class dbt_contracts.contracts.terms.node.HasNoFinalSemicolonο
Bases:
NodeContractTerm,GenericCheck if {kind} have a final semicolon present in their queries.
- run(item: ItemT, context: ContractContext, parent: ParentT = None) boolο
Validate the context before running the term.
- class dbt_contracts.contracts.terms.node.HasNoHardcodedRefsο
Bases:
NodeContractTerm,GenericCheck if {kind} have any hardcoded references to database objects in their queries.
- comments_pattern: ClassVar[str] = '(?<=(\\/\\*|\\{#))((.|[\\r\\n])+?)(?=(\\*+\\/|#\\}))|[ \\t]*--.*'ο
- cte_keywords: ClassVar[frozenset[str]] = frozenset({'with'})ο
- cte_pattern: ClassVar[str] = '^[\\w\\d_-]+$'ο
- ref_keywords: ClassVar[frozenset[str]] = frozenset({'from', 'join'})ο
- ref_ignore: ClassVar[frozenset[str]] = frozenset({'values'})ο
- run(item: ItemT, context: ContractContext, parent: ParentT = None) boolο
Validate the context before running the term.