Manifest Checks: Models#
Note
The below checks require manifest.json to be present.
Classes:
| Name | Description |
|---|---|
CheckModelAccess |
Models must have the specified access attribute. Requires dbt 1.7+. |
CheckModelCodeDoesNotContainRegexpPattern |
The raw code for a model must not match the specified regexp pattern. |
CheckModelColumnsHaveMetaKeys |
Columns defined for models must have the specified keys in the |
CheckModelColumnsHaveTypes |
Columns defined for models must have a |
CheckModelContractsEnforcedForPublicModel |
Public models must have contracts enforced. |
CheckModelDependsOnMacros |
Models must depend on the specified macros. |
CheckModelDependsOnMultipleSources |
Models cannot reference more than one source. |
CheckModelDescriptionContainsRegexPattern |
Models must have a description that matches the provided pattern. |
CheckModelDescriptionPopulated |
Models must have a populated description. |
CheckModelDirectories |
Only specified sub-directories are permitted. |
CheckModelDocumentedInSameDirectory |
Models must be documented in the same directory where they are defined (i.e. |
CheckModelFileName |
Models must have a file name that matches the supplied regex. |
CheckModelGrantPrivilege |
Model can have grant privileges that match the specified pattern. |
CheckModelGrantPrivilegeRequired |
Model must have the specified grant privilege. |
CheckModelHasConstraints |
Table and incremental models must have the specified constraint types defined. |
CheckModelHasContractsEnforced |
Model must have contracts enforced. |
CheckModelHasExposure |
Models must have an exposure. |
CheckModelHasMetaKeys |
The |
CheckModelHasNoUpstreamDependencies |
Identify if models have no upstream dependencies as this likely indicates hard-coded tables references. |
CheckModelHasSemiColon |
Model may not end with a semi-colon ( |
CheckModelHasTags |
Models must have the specified tags. |
CheckModelHasUniqueTest |
Models must have a test for uniqueness of a column. |
CheckModelHasUnitTests |
Models must have more than the specified number of unit tests. |
CheckModelLatestVersionSpecified |
Check that the |
CheckModelMaxChainedViews |
Models cannot have more than the specified number of upstream dependents that are not tables. |
CheckModelMaxFanout |
Models cannot have more than the specified number of downstream models. |
CheckModelMaxNumberOfLines |
Models may not have more than the specified number of lines. |
CheckModelMaxUpstreamDependencies |
Limit the number of upstream dependencies a model has. |
CheckModelNames |
Models must have a name that matches the supplied regex. |
CheckModelNumberOfGrants |
Model can have the specified number of privileges. |
CheckModelPropertyFileLocation |
Model properties files must follow the guidance provided by dbt here. |
CheckModelSchemaName |
Models must have a schema name that matches the supplied regex. |
CheckModelVersionAllowed |
Check that the version of the model matches the supplied regex pattern. |
CheckModelVersionPinnedInRef |
Check that the version of the model is always specified in downstream nodes. |
CheckModelsDocumentationCoverage |
Set the minimum percentage of models that have a populated description. |
CheckModelsTestCoverage |
Set the minimum percentage of models that have at least one test. |
CheckModelAccess
#
Models must have the specified access attribute. Requires dbt 1.7+.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
access
|
Literal['private', 'protected', 'public']
|
The access level to check for. |
required |
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
# Align with dbt best practices that marts should be `public`, everything else should be `protected`
- name: check_model_access
access: protected
include: ^models/intermediate
- name: check_model_access
access: public
include: ^models/marts
- name: check_model_access
access: protected
include: ^models/staging
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelCodeDoesNotContainRegexpPattern
#
The raw code for a model must not match the specified regexp pattern.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
regexp_pattern
|
str
|
The regexp pattern that should not be matched by the model code. |
required |
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
# Prefer `coalesce` over `ifnull`: https://docs.sqlfluff.com/en/stable/rules.html#sqlfluff.rules.sphinx.Rule_CV02
- name: check_model_code_does_not_contain_regexp_pattern
regexp_pattern: .*[i][f][n][u][l][l].*
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelColumnsHaveMetaKeys
#
Columns defined for models must have the specified keys in the meta config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keys
|
NestedDict
|
A list (that may contain sub-lists) of required keys. |
required |
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelColumnsHaveTypes
#
Columns defined for models must have a data_type declared.
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelContractsEnforcedForPublicModel
#
Public models must have contracts enforced.
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelDependsOnMacros
#
Models must depend on the specified macros.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
criteria
|
(Literal["any", "all", "one"] | None): Whether the model must depend on any, all, or exactly one of the specified macros. Default: |
required | |
required_macros
|
(list[str]): List of macros the model must depend on. All macros must specify a namespace, e.g. |
required |
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
- name: check_model_depends_on_macros
required_macros:
- dbt.is_incremental
- name: check_model_depends_on_macros
criteria: one
required_macros:
- my_package.sampler
- my_package.sampling
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelDependsOnMultipleSources
#
Models cannot reference more than one source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
required |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelDescriptionContainsRegexPattern
#
Models must have a description that matches the provided pattern.
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
regexp_pattern |
str
|
The regexp pattern that should match the model description. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
- name: check_model_description_contains_regex_pattern
- regex_pattern: .*pattern_to_match.*
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelDescriptionPopulated
#
Models must have a populated description.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_description_length
|
int | None
|
Minimum length required for the description to be considered populated. |
required |
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
- name: check_model_description_populated
min_description_length: 25 # Setting a stricter requirement for description length
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelDirectories
#
Only specified sub-directories are permitted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include
|
str
|
Regex pattern to the directory to check. |
required |
permitted_sub_directories
|
list[str]
|
List of permitted sub-directories. |
required |
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
- name: check_model_directories
include: models
permitted_sub_directories:
- intermediate
- marts
- staging
# Restrict sub-directories within `./models/staging`
- name: check_model_directories
include: ^models/staging
permitted_sub_directories:
- crm
- payments
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelDocumentedInSameDirectory
#
Models must be documented in the same directory where they are defined (i.e. .yml and .sql files are in the same directory).
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelFileName
#
Models must have a file name that matches the supplied regex.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_name_pattern
|
str
|
Regexp the file name must match. Please account for the |
required |
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
- name: check_model_file_name
description: Marts must include the model version in their file name.
include: ^models/marts
file_name_pattern: .*(v[0-9])\.sql$
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelGrantPrivilege
#
Model can have grant privileges that match the specified pattern.
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
privilege_pattern |
str
|
Regex pattern to match the privilege. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
- name: check_model_grant_privilege
include: ^models/marts
privilege_pattern: ^select
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelGrantPrivilegeRequired
#
Model must have the specified grant privilege.
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
privilege |
str
|
The privilege that is required. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
- name: check_model_grant_privilege_required
include: ^models/marts
privilege: select
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelHasConstraints
#
Table and incremental models must have the specified constraint types defined.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
required_constraint_types
|
list[Literal['check', 'custom', 'foreign_key', 'not_null', 'primary_key', 'unique']]
|
List of constraint types that must be present on the model. |
required |
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
- name: check_model_has_constraints
required_constraint_types:
- primary_key
include: ^models/marts
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelHasContractsEnforced
#
Model must have contracts enforced.
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelHasExposure
#
Models must have an exposure.
Receives at execution time:
| Name | Type | Description |
|---|---|---|
exposures |
list[DbtBouncerExposureBase]
|
List of DbtBouncerExposureBase objects parsed from |
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
- name: check_model_has_exposure
description: Ensure all marts are part of an exposure.
include: ^models/marts
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelHasMetaKeys
#
The meta config for models must have the specified keys.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keys
|
NestedDict
|
A list (that may contain sub-lists) of required keys. |
required |
model
|
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
required |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelHasNoUpstreamDependencies
#
Identify if models have no upstream dependencies as this likely indicates hard-coded tables references.
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelHasSemiColon
#
Model may not end with a semi-colon (;).
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelHasTags
#
Models must have the specified tags.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
criteria
|
(Literal["any", "all", "one"] | None): Whether the model must have any, all, or exactly one of the specified tags. Default: |
required | |
model
|
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
required |
tags
|
list[str]
|
List of tags to check for. |
required |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelHasUniqueTest
#
Models must have a test for uniqueness of a column.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
accepted_uniqueness_tests
|
list[str] | None
|
List of tests that are accepted as uniqueness tests. |
required |
model
|
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
required |
tests
|
list[DbtBouncerTestBase]
|
List of DbtBouncerTestBase objects parsed from |
required |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
# Example of allowing a custom uniqueness test
- name: check_model_has_unique_test
accepted_uniqueness_tests:
- dbt_expectations.expect_compound_columns_to_be_unique # i.e. tests from packages must include package name
- my_custom_uniqueness_test
- unique
Source code in src/dbt_bouncer/checks/manifest/check_models.py
1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 | |
CheckModelHasUnitTests
#
Models must have more than the specified number of unit tests.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_number_of_unit_tests
|
int | None
|
The minimum number of unit tests that a model must have. |
required |
Receives at execution time:
| Name | Type | Description |
|---|---|---|
manifest_obj |
DbtBouncerManifest
|
The DbtBouncerManifest object parsed from |
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
unit_tests |
list[UnitTests]
|
List of UnitTests objects parsed from |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Warning
This check is only supported for dbt 1.8.0 and above.
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_models.py
1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 | |
CheckModelLatestVersionSpecified
#
Check that the latest_version attribute of the model is set.
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelMaxChainedViews
#
Models cannot have more than the specified number of upstream dependents that are not tables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
materializations_to_include
|
list[str] | None
|
List of materializations to include in the check. |
required |
max_chained_views
|
int | None
|
The maximum number of upstream dependents that are not tables. |
required |
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
models |
list[DbtBouncerModelBase]
|
List of DbtBouncerModelBase objects parsed from |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
- name: check_model_max_chained_views
materializations_to_include:
- ephemeral
- my_custom_materialization
- view
max_chained_views: 5
Source code in src/dbt_bouncer/checks/manifest/check_models.py
1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 | |
CheckModelMaxFanout
#
Models cannot have more than the specified number of downstream models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_downstream_models
|
int | None
|
The maximum number of permitted downstream models. |
required |
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
models |
list[DbtBouncerModelBase]
|
List of DbtBouncerModelBase objects parsed from |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelMaxNumberOfLines
#
Models may not have more than the specified number of lines.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_number_of_lines
|
int
|
The maximum number of permitted lines. |
required |
model
|
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
required |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelMaxUpstreamDependencies
#
Limit the number of upstream dependencies a model has.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_upstream_macros
|
int | None
|
The maximum number of permitted upstream macros. |
required |
max_upstream_models
|
int | None
|
The maximum number of permitted upstream models. |
required |
max_upstream_sources
|
int | None
|
The maximum number of permitted upstream sources. |
required |
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_models.py
1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 | |
CheckModelNames
#
Models must have a name that matches the supplied regex.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name_pattern
|
str
|
Regexp the model name must match. |
required |
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
- name: check_model_names
include: ^models/intermediate
model_name_pattern: ^int_
- name: check_model_names
include: ^models/staging
model_name_pattern: ^stg_
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelNumberOfGrants
#
Model can have the specified number of privileges.
Receives at execution time:
| Name | Type | Description |
|---|---|---|
max_number_of_privileges |
int | None
|
Maximum number of privileges, inclusive. |
min_number_of_privileges |
int | None
|
Minimum number of privileges, inclusive. |
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
- name: check_model_number_of_grants
include: ^models/marts
max_number_of_privileges: 1 # Optional
min_number_of_privileges: 0 # Optional
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelPropertyFileLocation
#
Model properties files must follow the guidance provided by dbt here.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
required |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_models.py
1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 | |
CheckModelSchemaName
#
Models must have a schema name that matches the supplied regex.
Note that most setups will use schema names in development that are prefixed, for example: * dbt_jdoe_stg_payments * mary_stg_payments
Please account for this if you wish to run dbt-bouncer against locally generated manifests.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema_name_pattern
|
str
|
Regexp the schema name must match. |
required |
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
- name: check_model_schema_name
include: ^models/intermediate
schema_name_pattern: .*intermediate # Accounting for schemas like `dbt_jdoe_intermediate`.
- name: check_model_schema_name
include: ^models/staging
schema_name_pattern: .*stg_.*
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelVersionAllowed
#
Check that the version of the model matches the supplied regex pattern.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version_pattern
|
str
|
Regexp the version must match. |
required |
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
- name: check_model_version_allowed
include: ^models/marts
version_pattern: >- # Versions must be numeric
[0-9]\d*
- name: check_model_version_allowed
include: ^models/marts
version_pattern: ^(stable|latest)$ # Version can be "stable" or "latest", nothing else is permitted
Source code in src/dbt_bouncer/checks/manifest/check_models.py
CheckModelVersionPinnedInRef
#
Check that the version of the model is always specified in downstream nodes.
Receives at execution time:
| Name | Type | Description |
|---|---|---|
manifest_obj |
DbtBouncerManifest
|
The DbtBouncerManifest object parsed from |
model |
DbtBouncerModelBase
|
The DbtBouncerModelBase object to check. |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
materialization |
Literal['ephemeral', 'incremental', 'table', 'view'] | None
|
Limit check to models with the specified materialization. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_models.py
1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 | |
CheckModelsDocumentationCoverage
#
Set the minimum percentage of models that have a populated description.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_description_length
|
int | None
|
Minimum length required for the description to be considered populated. |
required |
min_model_documentation_coverage_pct
|
float
|
The minimum percentage of models that must have a populated description. |
required |
Receives at execution time:
| Name | Type | Description |
|---|---|---|
models |
list[DbtBouncerModelBase]
|
List of DbtBouncerModelBase objects parsed from |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
- name: check_model_documentation_coverage
min_model_documentation_coverage_pct: 90
manifest_checks:
- name: check_model_documentation_coverage
min_description_length: 25 # Setting a stricter requirement for description length
Source code in src/dbt_bouncer/checks/manifest/check_models.py
2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 | |
CheckModelsTestCoverage
#
Set the minimum percentage of models that have at least one test.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_model_test_coverage_pct
|
float
|
The minimum percentage of models that must have at least one test. |
required |
models
|
list[DbtBouncerModelBase]
|
List of DbtBouncerModelBase objects parsed from |
required |
tests
|
list[DbtBouncerTestBase]
|
List of DbtBouncerTestBase objects parsed from |
required |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
severity |
Literal['error', 'warn'] | None
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_models.py
2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 | |