# dbt™️ commands

## `dbt-clean`

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

**Example**

```yaml
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**

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

or

```yaml
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**

```yaml
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**

```yaml
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 `+`.<br>

**Example**

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

or

```yaml
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**

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

or

```yaml
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**

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

or

```yaml
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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.paradime.io/app-help/documentation/integrations/code-ide/pre-commit/dbt-tm-checkpoint-hooks/dbt-tm-commands.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
