Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interactive Compile #3179

Merged
merged 5 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion website/docs/reference/commands/compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,24 @@ The `compile` command is useful for:
2. Manually running compiled SQL. While debugging a model or schema test, it's often useful to execute the underlying `select` statement to find the source of the bug.
3. Compiling `analysis` files. Read more about analysis files [here](/docs/build/analyses).

It is _not_ a pre-requisite of `dbt run`.
<VersionBlock firstVersion="1.5">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the convention around what to put in the version block? I'd assume it was only highlighting that this is net new behavior, and documenting below outside the version block.

Copy link
Contributor Author

@matthewshaver matthewshaver Apr 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We deprecated the use of changelogs in favor of version blocks to help reign in the amount of information displayed on the screen. Since we version the docs themselves, this makes a generally more pleasing UX, and gives us a nice way to dynamically change the content (where appropriate) for different product versions.


Starting in dbt v1.5, `compile` becomes interactive in the CLI using the selection syntax `--select` or `--inline` to target specific models or Jinja references, respectively. This will display the compiled SQL in the terminal (in addition to the `target/` directory).

For example:

```
dbt compile --select stg_payments
```

or

```
dbt compile --inline "select * from {{ ref('raw_orders') }}"
```

<Lightbox src="/img/docs/reference/dbt-compile.png" title="dbt compile --select stg_payments"/>

</VersionBlock>

It is _not_ a pre-requisite of `dbt run`.
2 changes: 1 addition & 1 deletion website/docs/reference/node-selection/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dbt's node selection syntax makes it possible to run only specific resources in
| [seed](commands/seed) | `--select`, `--exclude`, `--selector` |
| [snapshot](commands/snapshot) | `--select`, `--exclude` `--selector` |
| [ls (list)](commands/list) | `--select`, `--exclude`, `--selector`, `--resource-type` |
| [compile](commands/compile) | `--select`, `--exclude`, `--selector` |
| [compile](commands/compile) | `--select`, `--exclude`, `--selector`, `--inline` |
| [freshness](commands/source) | `--select`, `--exclude`, `--selector` |
| [build](commands/build) | `--select`, `--exclude`, `--selector`, `--resource-type`, `--defer` |

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.