dbt™️ commands

dbt-clean

Run the dbt clean command. Deletes all folders specified in the clean-targets.

Example

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: dbt-clean

dbt-compile

Run the dbt compile command. Generates executable SQL from source model, test, and analysis files.

Arguments

--global-flags: Global dbt flags applicable to all subcommands. Instead of dash - please use +. --cmd-flags: Command-specific dbt flags. Instead of dash - please use +. --model-prefix: Prefix dbt selector, for selecting parents. --model-postfix: Postfix dbt selector, for selecting children. --models: dbt-checkpoint is by default running changed files. If you need to override that, e.g. in case of Slim CI (state:modified), you can use this option.

Example

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: dbt-compile
        args: ["--model-prefix", "+", "--"]

or

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: dbt-compile
        args: ["--models", "state:modified", "--cmd-flags", "++defer", "++state", "path/to/artifacts", "--"]

⚠️ do not forget to include -- as the last argument. Otherwise pre-commit would not be able to separate a list of files with args.


dbt-deps

Run dbt deps command. Pulls the most recent version of the dependencies listed in your packages.yml.

Example

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: dbt-deps

dbt-docs-generate

Run dbt docs generate command. The command is responsible for generating your project's documentation website.

Example

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: dbt-docs-generate

dbt-parse

Run the dbt parse command. When running dbt >= 1.5, generates manifest.json from source model, test, and analysis files.

Arguments

--global-flags: Global dbt flags applicable to all subcommands. Instead of dash - please use +. --cmd-flags: Command-specific dbt flags. Instead of dash - please use +.

Example

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: dbt-parse

or

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: dbt-parse
        args: ["--cmd-flags", "++profiles-dir", ".", "++project-dir", ".", "--"]

⚠️ do not forget to include -- as the last argument. Otherwise pre-commit would not be able to separate a list of files with args.


dbt-run

Run dbt run command. Executes compiled SQL model files.

Arguments

--global-flags: Global dbt flags applicable to all subcommands. Instead of dash - please use +. --cmd-flags: Command-specific dbt flags. Instead of dash - please use +. --model-prefix: Prefix dbt selector, for selecting parents. --model-postfix: Postfix dbt selector, for selecting children. --models: dbt-checkpoint is by default running changed files. If you need to override that, e.g. in case of Slim CI (state:modified), you can use this option.

Example

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: dbt-run
        args: ["--model-prefix", "+", "--"]

or

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: dbt-run
        args: ["--models", "state:modified", "--cmd-flags", "++defer", "++state", "path/to/artifacts", "--"]

⚠️ do not forget to include -- as the last argument. Otherwise pre-commit would not be able to separate a list of files with args.


dbt-test

Run dbt test command. Runs tests on data in deployed models.

Arguments

--global-flags: Global dbt flags applicable to all subcommands. Instead of dash - please use +. --cmd-flags: Command-specific dbt flags. Instead of dash - please use +. --model-prefix: Prefix dbt selector, for selecting parents. --model-postfix: Postfix dbt selector, for selecting children. --models: dbt-checkpoint is by default running changed files. If you need to override that, e.g. in case of Slim CI (state:modified), you can use this option.

Example

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: dbt-test
        args: ["--model-prefix", "+", "--"]

or

repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: dbt-test
        args: ["--models", "state:modified", "--cmd-flags", "++defer", "++state", "path/to/artifacts", "--"]

⚠️ do not forget to include -- as the last argument. Otherwise pre-commit would not be able to separate a list of files with args.

Last updated