dbt™️ checks
check-macro-has-meta-keys
check-macro-has-meta-keysBy default, it does not allow the macro to have any other meta keys other than the ones required. An optional argument can be used to allow for extra 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 macro.
--allow-extra-keys: whether extra keys are allowed. Default: False.
Example
repos:
- repo: https://github.com/dbt-checkpoint/dbt-checkpoint
rev: v1.2.1
hooks:
- id: check-macro-has-meta-keys
args: ['--meta-keys', 'foo', 'bar', "--"]⚠️ 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
Macro exists in manifest.json 1
Macro 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
ymlfiles.The manifest is scanned for a macro.
If any macro (from a manifest or
ymlfiles) 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 macro and then you delete meta keys from a properties file, the hook success since the meta keys is still present in manifest.json.
check-seed-has-meta-keys
check-seed-has-meta-keysBy default, it does not allow the seed to have any other meta keys other than the ones required. An optional argument can be used to allow for extra 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 seed.
--allow-extra-keys: whether extra keys are allowed. Default: False.
Example
repos:
- repo: https://github.com/dbt-checkpoint/dbt-checkpoint
rev: v1.2.1
hooks:
- id: check-seed-has-meta-keys
args: ['--meta-keys', 'foo', 'bar', "--"]⚠️ 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
Seed exists in manifest.json 1
Seed 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
ymlfiles.The manifest is scanned for a seed.
If any seed (from a manifest or
ymlfiles) 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 seed and then you delete meta keys from a properties file, the hook success since the meta keys is still present in manifest.json.
check-snapshot-has-meta-keys
check-snapshot-has-meta-keysBy default, it does not allow the snapshot to have any other meta keys other than the ones required. An optional argument can be used to allow for extra 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 snapshot.
--allow-extra-keys: whether extra keys are allowed. Default: False.
Example
repos:
- repo: https://github.com/dbt-checkpoint/dbt-checkpoint
rev: v1.2.1
hooks:
- id: check-snapshot-has-meta-keys
args: ['--meta-keys', 'foo', 'bar', "--"]⚠️ 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
Snapshot exists in manifest.json 1
Snapshot exists in catalog.json 2
❌ Not
❌ 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
ymlandsqlfiles.The manifest is scanned for a snapshot.
If any snapshot (from a manifest or
ymlfiles) 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 snapshot and then you delete meta keys from a properties file, the hook success since the meta keys is still present in manifest.json.
check-test-has-meta-keys
check-test-has-meta-keysBy default, it does not allow the test to have any other meta keys other than the ones required. An optional argument can be used to allow for extra 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 test.
--allow-extra-keys: whether extra keys are allowed. Default: False.
Example
repos:
- repo: https://github.com/dbt-checkpoint/dbt-checkpoint
rev: v1.2.1
hooks:
- id: check-test-has-meta-keys
args: ['--meta-keys', 'foo', 'bar', "--"]⚠️ 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
Test exists in manifest.json 1
Test exists in catalog.json 2
❌ Not
❌ 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
sqlfiles.The manifest is scanned for a test.
If any test (from a manifest or
sqlfiles) 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 test and then you delete meta keys from a properties file, the hook success since the meta keys is still present in manifest.json.
check-database-casing-consistency
check-database-casing-consistencyArguments
--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
repos:
- repo: https://github.com/dbt-checkpoint/dbt-checkpoint
rev: v1.2.1
hooks:
- id: check-database-casing-consistencyHow it works
It compares models and sources databases and schemas in manifest vs catalog. If a db/schema in one of them presents a different casing, the hook fails.
Last updated
Was this helpful?