Paradime Help Docs
Get Started
  • 🚀Introduction
  • 📃Guides
    • Paradime 101
      • Getting Started with your Paradime Workspace
        • Creating a Workspace
        • Setting Up Data Warehouse Connections
        • Managing workspace configurations
        • Managing Users in the Workspace
      • Getting Started with the Paradime IDE
        • Setting Up a dbt™ Project
        • Creating a dbt™ Model
        • Data Exploration in the Code IDE
        • DinoAI: Accelerating Your Analytics Engineering Workflow
          • DinoAI Agent
            • Creating dbt Sources from Data Warehouse
            • Generating Base Models
            • Building Intermediate/Marts Models
            • Documentation Generation
            • Data Pipeline Configuration
            • Using .dinorules to Tailor Your AI Experience
          • Accelerating GitOps
          • Accelerating Data Governance
          • Accelerating dbt™ Development
        • Utilizing Advanced Developer Features
          • Visualize Data Lineage
          • Auto-generated Data Documentation
          • Enforce SQL and YAML Best Practices
          • Working with CSV Files
      • Managing dbt™ Schedules with Bolt
        • Creating Bolt Schedules
        • Understanding schedule types and triggers
        • Viewing Run History and Analytics
        • Setting Up Notifications
        • Debugging Failed Runs
    • Migrating from dbt™ cloud to Paradime
  • 🔍Concepts
    • Working with Git
      • Git Lite
      • Git Advanced
      • Read Only Branches
      • Delete Branches
      • Merge Conflicts
      • Configuring Signed Commits on Paradime with SSH Keys
      • GitHub Branch Protection Guide: Preventing Direct Commits to Main
    • dbt™ fundamentals
      • Getting started with dbt™
        • Introduction
        • Project Strucuture
        • Working with Sources
        • Testing Data Quality
        • Models and Transformations
      • Configuring your dbt™ Project
        • Setting up your dbt_project.yml
        • Defining Your Sources in sources.yml
        • Testing Source Freshness
        • Unit Testing
        • Working with Tags
        • Managing Seeds
        • Environment Management
        • Variables and Parameters
        • Macros
        • Custom Tests
        • Hooks & Operational Tasks
        • Packages
      • Model Materializations
        • Table Materialization
        • View​ Materialization
        • Incremental Materialization
          • Using Merge for Incremental Models
          • Using Delete+Insert for Incremental Models
          • Using Append for Incremental Models
          • Using Microbatch for Incremental Models
        • Ephemeral Materialization
        • Snapshots
      • Running dbt™
        • Mastering the dbt™ CLI
          • Commands
          • Methods
          • Selector Methods
          • Graph Operators
    • Paradime fundamentals
      • Global Search
        • Paradime Apps Navigation
        • Invite users to your workspace
        • Search and preview Bolt schedules status
      • Using --defer in Paradime
      • Workspaces and data mesh
    • Data Warehouse essentials
      • BigQuery Multi-Project Service Account
  • 📖Documentation
    • DinoAI
      • Agent Mode
        • Use Cases
          • Creating Sources from your Warehouse
          • Generating dbt™ models
          • Fixing Errors with Jira
          • Researching with Perplexity
          • Providing Additional Context Using PDFs
      • Context
        • File Context
        • Directory Context
      • Tools and Features
        • Warehouse Tool
        • File System Tool
        • PDF Tool
        • Jira Tool
        • Perplexity Tool
        • Terminal Tool
        • Coming Soon Tools...
      • .dinorules
      • Ask Mode
      • Version Control
      • Production Pipelines
      • Data Documentation
    • Code IDE
      • User interface
        • Autocompletion
        • Context Menu
        • Flexible layout
        • "Peek" and "Go To" Definition
        • IDE preferences
        • Shortcuts
      • Left Panel
        • DinoAI Coplot
        • Search, Find, and Replace
        • Git Lite
        • Bookmarks
      • Command Panel
        • Data Explorer
        • Lineage
        • Catalog
        • Lint
      • Terminal
        • Running dbt™
        • Paradime CLI
      • Additional Features
        • Scratchpad
    • Bolt
      • Creating Schedules
        • 1. Schedule Settings
        • 2. Command Settings
          • dbt™ Commands
          • Python Scripts
          • Elementary Commands
          • Lightdash Commands
          • Tableau Workbook Refresh
          • Power BI Dataset Refresh
          • Paradime Bolt Schedule Toggle Commands
          • Monte Carlo Commands
        • 3. Trigger Types
        • 4. Notification Settings
        • Templates
          • Run and Test all your dbt™ Models
          • Snapshot Source Data Freshness
          • Build and Test Models with New Source Data
          • Test Code Changes On Pull Requests
          • Re-executes the last dbt™ command from the point of failure
          • Deploy Code Changes On Merge
          • Create Jira Tickets
          • Trigger Census Syncs
          • Trigger Hex Projects
          • Create Linear Issues
          • Create New Relic Incidents
          • Create Azure DevOps Items
        • Schedules as Code
      • Managing Schedules
        • Schedule Configurations
        • Viewing Run Log History
        • Analyzing Individual Run Details
          • Configuring Source Freshness
      • Bolt API
      • Special Environment Variables
        • Audit environment variables
        • Runtime environment variables
      • Integrations
        • Reverse ETL
          • Hightouch
        • Orchestration
          • Airflow
          • Azure Data Factory (ADF)
      • CI/CD
        • Turbo CI
          • Azure DevOps
          • BitBucket
          • GitHub
          • GitLab
          • Paradime Turbo CI Schema Cleanup
        • Continuous Deployment with Bolt
          • GitHub Native Continuous Deployment
          • Using Azure Pipelines
          • Using BitBucket Pipelines
          • Using GitLab Pipelines
        • Column-Level Lineage Diff
          • dbt™ mesh
          • Looker
          • Tableau
          • Thoughtspot
    • Radar
      • Get Started
      • Cost Management
        • Snowflake Cost Optimization
        • Snowflake Cost Monitoring
        • BigQuery Cost Monitoring
      • dbt™ Monitoring
        • Schedules Dashboard
        • Models Dashboard
        • Sources Dashboard
        • Tests Dashboard
      • Team Efficiency Tracking
      • Real-time Alerting
      • Looker Monitoring
    • Data Catalog
      • Data Assets
        • Looker assets
        • Tableau assets
        • Power BI assets
        • Sigma assets
        • ThoughtSpot assets
        • Fivetran assets
        • dbt™️ assets
      • Lineage
        • Search and Discovery
        • Filters and Nodes interaction
        • Nodes navigation
        • Canvas interactions
        • Compare Lineage version
    • Integrations
      • Dashboards
        • Sigma
        • ThoughtSpot (Beta)
        • Lightdash
        • Tableau
        • Looker
        • Power BI
        • Streamlit
      • Code IDE
        • Cube CLI
        • dbt™️ generator
        • Prettier
        • Harlequin
        • SQLFluff
        • Rainbow CSV
        • Mermaid
          • Architecture Diagrams
          • Block Diagrams Documentation
          • Class Diagrams
          • Entity Relationship Diagrams
          • Gantt Diagrams
          • GitGraph Diagrams
          • Mindmaps
          • Pie Chart Diagrams
          • Quadrant Charts
          • Requirement Diagrams
          • Sankey Diagrams
          • Sequence Diagrams
          • State Diagrams
          • Timeline Diagrams
          • User Journey Diagrams
          • XY Chart
          • ZenUML
        • pre-commit
          • Paradime Setup and Configuration
          • dbt™️-checkpoint hooks
            • dbt™️ Model checks
            • dbt™️ Script checks
            • dbt™️ Source checks
            • dbt™️ Macro checks
            • dbt™️ Modifiers
            • dbt™️ commands
            • dbt™️ checks
          • SQLFluff hooks
          • Prettier hooks
      • Observability
        • Elementary Data
          • Anomaly Detection Tests
            • Anomaly tests parameters
            • Volume anomalies
            • Freshness anomalies
            • Event freshness anomalies
            • Dimension anomalies
            • All columns anomalies
            • Column anomalies
          • Schema Tests
            • Schema changes
            • Schema changes from baseline
          • Sending alerts
            • Slack alerts
            • Microsoft Teams alerts
            • Alerts Configuration and Customization
          • Generate observability report
          • CLI commands and usage
        • Monte Carlo
      • Storage
        • Amazon S3
        • Snowflake Storage
      • Reverse ETL
        • Hightouch
      • CI/CD
        • GitHub
        • Spectacles
      • Notifications
        • Microsoft Teams
        • Slack
      • ETL
        • Fivetran
    • Security
      • Single Sign On (SSO)
        • Okta SSO
        • Azure AD SSO
        • Google SAML SSO
        • Google Workspace SSO
        • JumpCloud SSO
      • Audit Logs
      • Security model
      • Privacy model
      • FAQs
      • Trust Center
      • Security
    • Settings
      • Workspaces
      • Git Repositories
        • Importing a repository
          • Azure DevOps
          • BitBucket
          • GitHub
          • GitLab
        • Update connected git repository
      • Connections
        • Code IDE environment
          • Amazon Athena
          • BigQuery
          • Clickhouse
          • Databricks
          • Dremio
          • DuckDB
          • Firebolt
          • Microsoft Fabric
          • Microsoft SQL Server
          • MotherDuck
          • PostgreSQL
          • Redshift
          • Snowflake
          • Starburst/Trino
        • Scheduler environment
          • Amazon Athena
          • BigQuery
          • Clickhouse
          • Databricks
          • Dremio
          • DuckDB
          • Firebolt
          • Microsoft Fabric
          • Microsoft SQL Server
          • MotherDuck
          • PostgreSQL
          • Redshift
          • Snowflake
          • Starburst/Trino
        • Manage connections
          • Set alternative default connection
          • Delete connections
        • Cost connection
          • BigQuery cost connection
          • Snowflake cost connection
        • Connection Security
          • AWS PrivateLink
            • Snowflake PrivateLink
            • Redshift PrivateLink
          • BigQuery OAuth
          • Snowflake OAuth
        • Optional connection attributes
      • Notifications
      • dbt™
        • Upgrade dbt Core™ version
      • Users
        • Invite users
        • Manage Users
        • Enable Auto-join
        • Users and licences
        • Default Roles and Permissions
        • Role-based access control
      • Environment Variables
        • Bolt Schedules Environment Variables
        • Code IDE Environment Variables
  • 💻Developers
    • GraphQL API
      • Authentication
      • Examples
        • Audit Logs API
        • Bolt API
        • User Management API
        • Workspace Management API
    • Python SDK
      • Getting Started
      • Modules
        • Audit Log
        • Bolt
        • Lineage Diff
        • Custom Integration
        • User Management
        • Workspace Management
    • Paradime CLI
      • Getting Started
      • Bolt CLI
    • Webhooks
      • Getting Started
      • Custom Webhook Guides
        • Create an Azure DevOps Work item when a Bolt run complete with errors
        • Create a Linear Issue when a Bolt run complete with errors
        • Create a Jira Issue when a Bolt run complete with errors
        • Trigger a Slack notification when a Bolt run is overrunning
    • Virtual Environments
      • Using Poetry
      • Troubleshooting
    • API Keys
    • IP Restrictions in Paradime
    • Company & Workspace token
  • 🙌Best Practices
    • Data Mesh Setup
      • Configure Project dependencies
      • Model access
      • Model groups
  • ‼️Troubleshooting
    • Errors
    • Error List
    • Restart Code IDE
  • 🔗Other Links
    • Terms of Service
    • Privacy Policy
    • Paradime Blog
Powered by GitBook
On this page
  • check-column-desc-are-same
  • check-column-name-contract
  • check-model-columns-have-desc
  • check-model-has-all-columns
  • check-model-has-contract
  • check-model-has-constraints
  • check-model-has-description
  • check-model-has-meta-keys
  • check-model-has-labels-keys
  • check-model-has-properties-file
  • check-model-has-tests-by-name
  • check-model-has-tests-by-type
  • check-model-has-tests-by-group
  • check-model-has-tests
  • check-model-parents-and-childs
  • check-model-parents-database
  • check-model-parents-name-prefix
  • check-model-parents-schema

Was this helpful?

  1. Documentation
  2. Integrations
  3. Code IDE
  4. pre-commit
  5. dbt™️-checkpoint hooks

dbt™️ Model checks

check-column-desc-are-same

What it does

Check the models have the same descriptions for the same column names.

When to use it

E.g. in two of your models, you have customer_id with the description This is cutomer_id, but there is one model where column customer_id has a description Something else. This hook finds discrepancies between column descriptions.

Arguments

--ignore: columns for which do not check whether have a different description.

Example

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-column-desc-are-same

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 and SQL 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

What it does

When to use it

You want to make sure your columns follow a contract, e.g. all your boolean columns start with the prefixes is_, has_ or do_.

Arguments

--pattern: Regex pattern to match column names. --dtypes: Data types. --exclude: Regex pattern to exclude files.

Example

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-column-name-contract
        args: [--pattern, "(is|has|do)_.*", --dtypes, boolean text timestamp, "--"]

⚠️ 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

What it does

Ensures that the model has columns with descriptions in the properties file (usually schema.yml).

When to use it

You want to make sure that all specified columns in the properties files (usually schema.yml) have some description. This hook does not validate if all database columns are also present in a 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

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-model-columns-have-desc

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 and SQL 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

What it does

Ensures that all columns in the database are also specified in the properties file. (usually schema.yml).

When to use it

You want to make sure that you have all the database columns listed in the properties file, or that your properties file no longer contains deleted 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

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-model-has-all-columns

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

What it does

Checks that model's yaml has:

config:
  contract:
    enforced: true

When to use it

When you want to force developers to define model contracts.

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

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-model-has-contract

How it works

It checks the generated manifest for the contract configuration


check-model-has-constraints

What it does

Checks that model's yaml has specific constraints defined, eg:

  - name: products
    config:
      contract:
        enforced: true
    constraints:
      - type: foreign_key
        columns:
          - "product_id"

When to use it

When you want to force developers to define model 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

repos:
  - repo: https://github.com/xasm83/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-model-has-contract
      - id: check-model-has-constraints
        args: ["--constraints", '[{"type": "primary_key", "columns": ["product_id"]}]', "--"]

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

What it does

Ensures that the model has a description in the properties file (usually schema.yml).

When to use it

You want to make sure that all models have a 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

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-model-has-description

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 and SQL 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

What it does

Ensures that the model has a list of valid meta keys. (usually schema.yml).

By default, it does not allow the model to have any other meta keys other than the ones required. An optional argument can be used to allow for extra keys.

When to use it

If every model needs to have certain 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

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-model-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

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 and SQL 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

What it does

Ensures that the model has a list of valid labels keys. (usually schema.yml).

By default, it does not allow the model to have any other labels keys other than the ones required. An optional argument can be used to allow for extra keys.

When to use it

If every model needs to have certain 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

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-model-has-labels-keys
        args: ['--labels-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

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 and SQL 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

What it does

Ensures that the model has a properties file (schema file).

When to use it

You want to make sure that every model has a 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

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-model-has-properties-file

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

What it does

Ensures that the model has a number of tests of a certain name (e.g. data, unique).

When to use it

You want to make sure that every model has certain 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 --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

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-model-has-tests-by-name
        args: ["--tests", "unique=1", "data=1", "--"]

⚠️ 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

What it does

Ensures that the model has a number of tests of a certain type (data, schema).

When to use it

You want to make sure that every model has certain 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 --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

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-model-has-tests-by-type
        args: ["--tests", "schema=1", "data=1", "--"]

⚠️ 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

What it does

Ensures that the model has a number of tests from a group of tests.

When to use it

You want to make sure that every model has one (or more) of a group of eligible tests (e.g. a set of unique 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 --tests: list of test names. --test_cnt: number of tests required across test group. --exclude: Regex pattern to exclude files.

Example

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-model-has-tests-by-group
        args: ["--tests", "unique", "unique_where", "--test-cnt", "1", "--"]

⚠️ 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

What it does

Ensures that the model has a number of tests.

When to use it

You want to make sure that every model was tested.

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

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-model-has-tests
        args: ["--test-cnt", "2", "--"]

⚠️ 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

What it does

When to use it

You want to make sure your model names follow a naming convention (e.g., staging models start with a stg_ prefix).

Arguments

--pattern: Regex pattern to match model names. --exclude: Regex pattern to exclude files.

Example

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-model-name-contract
        args: [--pattern, "(base_|stg_).*"]
        files: models/staging/
     - id: check-model-name-contract
       args: [--pattern, "(dim_|fct_).*"]
       files: models/marts/

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

What it does

Ensures the model has a specific number (max/min) of parents or/and childs.

When to use it

You want to find orphaned models (empty file, hard-coded reference, etc.). Or you want to make sure that every model is used somewhere so you are not e.g. materializing unused tables.

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

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks: 
      - id: check-model-parents-and-childs
        args: ["--min-parent-cnt", "2", "--"]

⚠️ 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

What it does

Ensures the parent models or sources are from certain database.

When to use it

You want to be sure that certain models are using only models from specified database(s).

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

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-model-parents-database
        args: ["--blacklist", "SRC", "--"]

⚠️ 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

What it does

Ensures the parent model names have a certain prefix.

When to use it

You want to be sure that certain models are using only parent models with a specified 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

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-model-parents-name-prefix
        exclude: ^models/stage/
        args: ["--whitelist", "stage_", "--"]

⚠️ 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

What it does

Ensures the parent models or sources are from certain schema.

When to use it

You want to be sure that certain models are using only models from specified schema(s).

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

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-model-parents-schema
        args: ["--blacklist", "stage", "--"]

⚠️ 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

What it does

Ensures that the model has only valid tags from the provided list.

When to use it

Make sure you did not typo in 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

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-model-tags
        args: ["--tags", "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

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

What it does

Checks the model materialization by a given threshold of child models. All models with less child models then the treshold should be materialized as views (or ephemerals), all the rest as tables or incrementals.

When to use it

Make sure to increase the efficiency within your dbt run and make use of good materialization choices.

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

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-model-materialization-by-childs

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.

Previousdbt™️-checkpoint hooksNextdbt™️ Script checks

Last updated 4 months ago

Was this helpful?

Check that column name abides to a contract, as described in by Emily Riederer. A contract consists of a regex pattern and a series of data types.

Check that model name abides to a contract (similar to ). A contract consists of a regex pattern.

📖
this blog post
check-column-name-contract