dbt™️ Source checks
check-source-columns-have-desc
check-source-columns-have-desc
Example
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
❌
❌ 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
.All sources from yml file are parsed.
If any column in the source does not contain a description, the hook fails.
check-source-has-all-columns
check-source-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
Example
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
❌ No
✅ 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
yml
.All sources from yml file are parsed.
The catalog is scanned for a model.
If there is any discrepancy between found yml sources and catalog sources, the hook fails.
Known limitations
If you did not update the catalog and manifest results can be wrong.
check-source-table-has-description
check-source-table-has-description
Example
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
❌ Not needed
❌ 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
.All sources from yml file are parsed.
If the source table does not have a description, the hook fails.
check-source-has-freshness
check-source-has-freshness
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
❌ 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
.All sources from yml file are parsed.
If the source does not have freshness correctly set, the hook fails.
check-source-has-loader
check-source-has-loader
Example
Requirements
Model exists in manifest.json
1
Model exists in catalog.json
2
❌ Not needed
❌ 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
.All sources from yml file are parsed.
If the source does not have a loader set, the hook fails.
check-source-has-meta-keys
check-source-has-meta-keys
Arguments
--meta-keys
: list of the required keys in the meta part of the model.
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
.All sources from yml file are parsed.
If the source does not have the required meta keys set, the hook fails.
check-source-has-labels-keys
check-source-has-labels-keys
Arguments
--labels-keys
: list of the required keys in the labels part of the model.
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
.All sources from yml file are parsed.
If the source does not have the required labels keys set, the hook fails.
check-source-has-tests-by-name
check-source-has-tests-by-name
Arguments
--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).
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
yml
.All sources from yml file are parsed.
If the source does not have the required test names, the hook fails.
check-source-has-tests-by-type
check-source-has-tests-by-type
Arguments
--tests
: key-value pairs of test types. Key is a 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).
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
yml
.All sources from yml file are parsed.
If the source does not have the required test types, the hook fails.
check-source-has-tests
check-source-has-tests
Arguments
--test-cnt
: Minimum number of tests required.
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
yml
.All sources from yml file are parsed.
If the source does not have the required test count, the hook fails.
check-source-has-tests-by-group
check-source-has-tests-by-group
Arguments
--tests
: list of test names. --test_cnt
: number of tests required across test group.
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 source name is obtained from the
SQL
file name.If any source does not have the number of required tests, the hook fails.
check-source-tags
check-source-tags
Arguments
--tags
: A list of tags that sources can have.
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
❌ 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
.All sources from yml file are parsed.
If the source has different tags than specified, the hook fails.
check-source-childs
check-source-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-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
yml
.All sources from yml file are parsed.
The manifest is scanned for child models.
If any source does not have a number of required childs, the hook fails.
Last updated
Was this helpful?