dbt™️ Script checks
check-script-ref-and-source
check-script-ref-and-sourceArguments
--manifest: location of manifest.json file. Usually target/manifest.json. This file contains a full representation of dbt project. Default: target/manifest.json
Example
repos:
- repo: https://github.com/dbt-checkpoint/dbt-checkpoint
rev: v1.0.0
hooks:
- id: check-script-ref-and-sourceRequirements
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.
check-script-semicolon
check-script-semicolonExample
repos:
- repo: https://github.com/dbt-checkpoint/dbt-checkpoint
rev: v1.0.0
hooks:
- id: check-script-semicolonHow it works
Hook takes all changed
SQLfiles.It parses
SQLand finds all sources and refs. If those objects do not exist inmanifest.json, the hook fails.
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
SQLfiles.If the file contains a semicolon at the end of the file, the hook fails.
check-script-has-no-table-name
check-script-has-no-table-nameArguments
--ignore-dotless-table: consider all tables without dot in name as CTE
Example
repos:
- repo: https://github.com/dbt-checkpoint/dbt-checkpoint
rev: v1.0.0
hooks:
- id: check-script-has-no-table-nameRequirements
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
SQLfiles.SQLis parsed and if it contains direct tables (not ref() or source()), the hook fails.
Last updated
Was this helpful?