dbt™️ Model checks
check-column-desc-are-same
check-column-desc-are-same
Arguments
--ignore
: columns for which do not check whether have a different description.
Example
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
❌ Not needed since it also validates properties files
❌ Not needed
1 It means that you need to run dbt parse
before run this hook (dbt >= 1.5).
2 It means that you need to run dbt docs generate
before run this hook.
How it works
Hook takes all changed
yml
andSQL
files.The model name is obtained from the
SQL
file name.The manifest is scanned for a model.
Modified
yml
files are scanned for a model.If any column in the found model has different descriptions than others, the hook fails.
The description must be in either the yml file or the manifest.
check-column-name-contract
check-column-name-contract
Arguments
--pattern
: Regex pattern to match column names. --dtypes
: Data types. --exclude
: Regex pattern to exclude files.
Example
⚠️ do not forget to include --
as the last argument. Otherwise pre-commit
would not be able to separate a list of files with args.
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
❌ Not needed
✅ Yes
1 It means that you need to run dbt parse
before run this hook (dbt >= 1.5).
2 It means that you need to run dbt docs generate
before run this hook.
How it works
Hook takes all changed
SQL
files.The model name is obtained from the
SQL
file name.The catalog is scanned for a model.
If any column in the found model matches the regex pattern and it's data type does not match the contract's data type, the hook fails.
If any column in the found model matches the contract's data type and does not match the regex pattern, the hook fails.
check-model-columns-have-desc
check-model-columns-have-desc
Arguments
--manifest
: location of manifest.json
file. Usually target/manifest.json
. This file contains a full representation of dbt project. Default: target/manifest.json
Example
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
❌ Not needed since it also validates properties files
❌ Not needed
1 It means that you need to run dbt parse
before run this hook (dbt >= 1.5).
2 It means that you need to run dbt docs generate
before run this hook.
How it works
Hook takes all changed
yml
andSQL
files.The model name is obtained from the
SQL
file name.The manifest is scanned for a model.
Modified
yml
files are scanned for a model.If any column in the found model does not contain a description, the hook fails.
The description must be in either the yml file or the manifest.
Known limitations
If you run
your model and then you delete column description from a properties file, the hook success since the description is still present in manifest.json
.
check-model-has-all-columns
check-model-has-all-columns
Arguments
--manifest
: location of manifest.json
file. Usually target/manifest.json
. This file contains a full representation of dbt project. Default: target/manifest.json
--catalog
: location of catalog.json
file. Usually target/catalog.json
. dbt uses this file to render information like column types and table statistics into the docs site. In dbt-checkpoint is used for column operations. Default: target/catalog.json
--exclude
: Regex pattern to exclude files.
Example
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
✅ Yes
✅ Yes
1 It means that you need to run dbt parse
before run this hook (dbt >= 1.5).
2 It means that you need to run dbt docs generate
before run this hook.
How it works
Hook takes all changed
SQL
files.The model name is obtained from the
SQL
file name.The manifest is scanned for a model.
The catalog is scanned for a model.
If there is any discrepancy between manifest and catalog models, the hook fails.
Known limitations
If you did not update the catalog and manifest results can be wrong.
check-model-has-contract
check-model-has-contract
Arguments
--manifest
: location of manifest.json
file. Usually target/manifest.json
. This file contains a full representation of dbt project. Default: target/manifest.json
--exclude
: Regex pattern to exclude files.
Example
How it works
It checks the generated manifest for the contract configuration
check-model-has-constraints
check-model-has-constraints
Arguments
--manifest
: location of manifest.json
file. Usually target/manifest.json
. This file contains a full representation of dbt project. Default: target/manifest.json
--constraints
: JSON string escaped by single quotes --exclude
: Regex pattern to exclude files.
Example
How it works
It checks the generated manifest for the required constraint. Only models with materialization "incremental" or "table" suport constraints. Enforced model contract is required as well. It checks only the keys defined in the '--constraints' parmeter, ie the actual constraint could have more parameters configured in dbt.
check-model-has-description
check-model-has-description
Arguments
--manifest
: location of manifest.json
file. Usually target/manifest.json
. This file contains a full representation of dbt project. Default: target/manifest.json
--exclude
: Regex pattern to exclude files.
Example
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
❌ Not needed since it also validates properties files
❌ Not needed
1 It means that you need to run dbt parse
before run this hook (dbt >= 1.5).
2 It means that you need to run dbt docs generate
before run this hook.
How it works
Hook takes all changed
yml
andSQL
files.The model name is obtained from the
SQL
file name.The manifest is scanned for a model.
Modified
yml
files are scanned for a model.If any model (from a manifest or
yml
files) does not have a description, the hook fails.The model description must be in either the yml file or the manifest.
Known limitations
If you run
your model and then you delete the description from a properties file, the hook success since the description is still present in manifest.json
.
check-model-has-meta-keys
check-model-has-meta-keys
Arguments
--manifest
: location of manifest.json
file. Usually target/manifest.json
. This file contains a full representation of dbt project. Default: target/manifest.json
--meta-keys
: list of the required keys in the meta part of the model.
--allow-extra-keys
: whether extra keys are allowed. Default: False
.
Example
⚠️ do not forget to include --
as the last argument. Otherwise pre-commit
would not be able to separate a list of files with args.
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
❌ Not needed since it also validates properties files
❌ Not needed
1 It means that you need to run dbt parse
before run this hook (dbt >= 1.5).
2 It means that you need to run dbt docs generate
before run this hook.
How it works
Hook takes all changed
yml
andSQL
files.The model name is obtained from the
SQL
file name.The manifest is scanned for a model.
Modified
yml
files are scanned for a model.If any model (from a manifest or
yml
files) does not have specified meta keys, the hook fails.The meta keys must be in either the yml file or the manifest.
Known limitations
If you run
your model and then you delete meta keys from a properties file, the hook success since the meta keys is still present in manifest.json
.
check-model-has-labels-keys
check-model-has-labels-keys
Arguments
--manifest
: location of manifest.json
file. Usually target/manifest.json
. This file contains a full representation of dbt project. Default: target/manifest.json
--labels-keys
: list of the required keys in the labels part of the model.
--allow-extra-keys
: whether extra keys are allowed. Default: False
.
Example
⚠️ do not forget to include --
as the last argument. Otherwise pre-commit
would not be able to separate a list of files with args.
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
❌ Not needed since it also validates properties files
❌ Not needed
1 It means that you need to run dbt parse
before run this hook (dbt >= 1.5).
2 It means that you need to run dbt docs generate
before run this hook.
How it works
Hook takes all changed
yml
andSQL
files.The model name is obtained from the
SQL
file name.The manifest is scanned for a model.
Modified
yml
files are scanned for a model.If any model (from a manifest or
yml
files) does not have specified labels keys, the hook fails.The labels keys must be in either the yml file or the manifest.
Known limitations
If you run
your model and then you delete labels keys from a properties file, the hook success since the labels keys is still present in manifest.json
.
check-model-has-properties-file
check-model-has-properties-file
Arguments
--manifest
: location of manifest.json
file. Usually target/manifest.json
. This file contains a full representation of dbt project. Default: target/manifest.json
Example
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
✅ Yes
❌ Not needed
1 It means that you need to run dbt parse
before run this hook (dbt >= 1.5).
2 It means that you need to run dbt docs generate
before run this hook.
How it works
Hook takes all changed
SQL
files.The model name is obtained from the
SQL
file name.The manifest is scanned for a model.
If any model does not have
patch_path
, the hook fails.
Known limitations
You need to create a schema file and then rerun your model (dbt run
or dbt compile
), otherwise, this hook will fail.
check-model-has-tests-by-name
check-model-has-tests-by-name
Arguments
--manifest
: location of manifest.json
file. Usually target/manifest.json
. This file contains a full representation of dbt project. Default: target/manifest.json
--tests
: key-value pairs of test names. Key is the name of test and value is required minimal number of tests eg. --test unique=1 not_null=2 (do not put spaces before or after the = sign).
--exclude
: Regex pattern to exclude files.
Example
⚠️ do not forget to include --
as the last argument. Otherwise pre-commit
would not be able to separate a list of files with args.
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
✅ Yes
❌ Not needed
1 It means that you need to run dbt parse
before run this hook (dbt >= 1.5).
2 It means that you need to run dbt docs generate
before run this hook.
How it works
Hook takes all changed
SQL
files.The model name is obtained from the
SQL
file name.The manifest is scanned for a model.
If any model does not have the number of required tests, the hook fails.
check-model-has-tests-by-type
check-model-has-tests-by-type
Arguments
--manifest
: location of manifest.json
file. Usually target/manifest.json
. This file contains a full representation of dbt project. Default: target/manifest.json
--tests
: key-value pairs of test types. Key is the type of test (data or schema) and value is required eg. --test data=1 schema=2 (do not put spaces before or after the = sign).
--exclude
: Regex pattern to exclude files.
Example
⚠️ do not forget to include --
as the last argument. Otherwise pre-commit
would not be able to separate a list of files with args.
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
✅ Yes
❌ Not needed
1 It means that you need to run dbt parse
before run this hook (dbt >= 1.5).
2 It means that you need to run dbt docs generate
before run this hook.
How it works
Hook takes all changed
SQL
files.The model name is obtained from the
SQL
file name.The manifest is scanned for a model.
If any model does not have the number of required tests, the hook fails.
check-model-has-tests-by-group
check-model-has-tests-by-group
Arguments
--manifest
: location of manifest.json
file. Usually target/manifest.json
. This file contains a full representation of dbt project. Default: target/manifest.json
--tests
: list of test names.
--test_cnt
: number of tests required across test group.
--exclude
: Regex pattern to exclude files.
Example
⚠️ do not forget to include --
as the last argument. Otherwise pre-commit
would not be able to separate a list of files with args.
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
✅ Yes
❌ Not needed
1 It means that you need to run dbt parse
before run this hook (dbt >= 1.5).
2 It means that you need to run dbt docs generate
before run this hook.
How it works
Hook takes all changed
SQL
files.The model name is obtained from the
SQL
file name.The manifest is scanned for a model.
If any model does not have the number of required tests, the hook fails.
check-model-has-tests
check-model-has-tests
Arguments
--manifest
: location of manifest.json
file. Usually target/manifest.json
. This file contains a full representation of dbt project. Default: target/manifest.json
--test-cnt
: Minimum number of tests required.
--exclude
: Regex pattern to exclude files.
Example
⚠️ do not forget to include --
as the last argument. Otherwise pre-commit
would not be able to separate a list of files with args.
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
✅ Yes
❌ Not needed
1 It means that you need to run dbt parse
before run this hook (dbt >= 1.5).
2 It means that you need to run dbt docs generate
before run this hook.
How it works
Hook takes all changed
SQL
files.The model name is obtained from the
SQL
file name.The manifest is scanned for a model.
If any model does not have a number of required tests, the hook fails.
check-model-name-contract
check-model-name-contract
Arguments
--pattern
: Regex pattern to match model names.
--exclude
: Regex pattern to exclude files.
Example
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
✅ Yes
❌ Not needed
1 It means that you need to run dbt parse
before run this hook (dbt >= 1.5).
2 It means that you need to run dbt docs generate
before run this hook.
How it works
Hook takes all changed
SQL
files.The model name is obtained from the
SQL
file name.The catalog is scanned for a model.
If any model does not match the regex pattern, the hook fails.
check-model-parents-and-childs
check-model-parents-and-childs
Arguments
--manifest
: location of manifest.json
file. Usually target/manifest.json
. This file contains a full representation of dbt project. Default: target/manifest.json
--min-parent-cnt
: Minimal number of parent sources and models. --max-parent-cnt
: Maximal number of parent sources and models. --min-child-cnt
: Minimal number of child models. --max-child-cnt
: Maximal number of child models.
Example
⚠️ do not forget to include --
as the last argument. Otherwise pre-commit
would not be able to separate a list of files with args.
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
✅ Yes
❌ Not needed
1 It means that you need to run dbt parse
before run this hook (dbt >= 1.5).
2 It means that you need to run dbt docs generate
before run this hook.
How it works
Hook takes all changed
SQL
files.The model name is obtained from the
SQL
file name.The manifest is scanned for a parent and child models.
If any model does not have a number of required parents/childs, the hook fails.
check-model-parents-database
check-model-parents-database
Arguments
--manifest
: location of manifest.json
file. Usually target/manifest.json
. This file contains a full representation of dbt project. Default: target/manifest.json
--whitelist
: list of allowed databases. --blacklist
: list of disabled databases. --exclude
: Regex pattern to exclude files.
Example
⚠️ do not forget to include --
as the last argument. Otherwise pre-commit
would not be able to separate a list of files with args.
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
✅ Yes
❌ Not needed
1 It means that you need to run dbt parse
before run this hook (dbt >= 1.5).
2 It means that you need to run dbt docs generate
before run this hook.
How it works
Hook takes all changed
SQL
files.The model name is obtained from the
SQL
file name.The manifest is scanned for a parent models/sources.
If any parent model does not have allowed or has disabled databases, the hook fails.
check-model-parents-name-prefix
check-model-parents-name-prefix
Arguments
--manifest
: location of manifest.json
file. Usually target/manifest.json
. This file contains a full representation of dbt project. Default: target/manifest.json
--whitelist
: list of allowed prefixes. --blacklist
: list of non-allowed prefixes. --exclude
: Regex pattern to exclude files.
Example
⚠️ do not forget to include --
as the last argument. Otherwise pre-commit
would not be able to separate a list of files with args.
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
✅ Yes
❌ Not needed
1 It means that you need to run dbt parse
before run this hook (dbt >= 1.5).
2 It means that you need to run dbt docs generate
before run this hook.
How it works
Hook takes all changed
SQL
files.The model name is obtained from the
SQL
file name.The manifest is scanned for a parent models/sources.
If any parent model does not have allowed or has disabled databases, the hook fails.
check-model-parents-schema
check-model-parents-schema
Arguments
--manifest
: location of manifest.json
file. Usually target/manifest.json
. This file contains a full representation of dbt project. Default: target/manifest.json
--whitelist
: list of allowed schemas. --blacklist
: list of disabled schemas.
Example
⚠️ do not forget to include --
as the last argument. Otherwise pre-commit
would not be able to separate a list of files with args.
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
✅ Yes
❌ Not needed
1 It means that you need to run dbt parse
before run this hook (dbt >= 1.5).
2 It means that you need to run dbt docs generate
before run this hook.
How it works
Hook takes all changed
SQL
files.The model name is obtained from the
SQL
file name.The manifest is scanned for a parent models/sources.
If any parent model does not have allowed or has disabled schemas, the hook fails.
check-model-tags
check-model-tags
Arguments
--manifest
: location of manifest.json
file. Usually target/manifest.json
. This file contains a full representation of dbt project. Default: target/manifest.json
--tags
: A list of tags that models can have. --exclude
: Regex pattern to exclude files.
Example
⚠️ do not forget to include --
as the last argument. Otherwise pre-commit
would not be able to separate a list of files with args.
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
✅ Yes
❌ Not needed
1 It means that you need to run dbt parse
before run this hook (dbt >= 1.5).
2 It means that you need to run dbt docs generate
before run this hook.
How it works
Hook takes all changed
SQL
files.The model name is obtained from the
SQL
file name.The manifest is scanned for a model.
If any model has different tags than specified, the hook fails.
check-model-materialization-by-childs
check-model-materialization-by-childs
Arguments
--manifest
: location of manifest.json
file. Usually target/manifest.json
. This file contains a full representation of dbt project. Default: target/manifest.json
--threshold-childs
: An integer threshold of the number of child models.
Example
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
✅ Yes
❌ Not needed
1 It means that you need to run dbt parse
before run this hook (dbt >= 1.5).
2 It means that you need to run dbt docs generate
before run this hook.
Last updated
Was this helpful?