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

Merging syntax sections #5898

Merged
merged 6 commits into from
Aug 7, 2024
Merged
Changes from 1 commit
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
20 changes: 3 additions & 17 deletions website/docs/reference/node-selection/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,23 +193,6 @@ The state and result selectors can also be combined in a single invocation of db
dbt run --select "result:<status>+" state:modified+ --defer --state ./<dbt-artifact-path>
```

### Fresh rebuilds

Only supported by v1.1 or newer.

When a job is selected, dbt Cloud will surface the artifacts from that job's most recent successful run. dbt will then use those artifacts to determine the set of fresh sources. In your job commands, you can signal to dbt to run and test only on these fresher sources and their children by including the `source_status:fresher+` argument. This requires both previous and current state to have the `sources.json` artifact be available. Or plainly said, both job states need to run `dbt source freshness`.

As example:

```bash
# Command step order
dbt source freshness
dbt build --select "source_status:fresher+"
```


For more example commands, refer to [Pro-tips for workflows](/best-practices/best-practice-workflows#pro-tips-for-workflows).

### The "source_status" status

Only supported by v1.1 or newer.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we remove this? ^

Expand All @@ -219,10 +202,13 @@ Another element of job state is the `source_status` of a prior dbt invocation. A
The following dbt commands produce `sources.json` artifacts whose results can be referenced in subsequent dbt invocations:
matthewshaver marked this conversation as resolved.
Show resolved Hide resolved
- `dbt source freshness`
matthewshaver marked this conversation as resolved.
Show resolved Hide resolved

When a job is selected, dbt Cloud will surface the artifacts from that job's most recent successful run. dbt will then use those artifacts to determine the set of fresh sources. In your job commands, you can signal dbt to run and test only on the fresher sources and their children by including the `source_status:fresher+` argument. This requires both the previous and current states to have the `sources.json` artifact available. Or plainly said, both job states need to run `dbt source freshness`.

After issuing one of the above commands, you can reference the source freshness results by adding a selector to a subsequent command as follows:
matthewshaver marked this conversation as resolved.
Show resolved Hide resolved

```bash
# You can also set the DBT_ARTIFACT_STATE_PATH environment variable instead of the --state flag.
dbt source freshness # must be run again to compare current to previous state
dbt build --select "source_status:fresher+" --state path/to/prod/artifacts
```
For more example commands, refer to [Pro-tips for workflows](/best-practices/best-practice-workflows#pro-tips-for-workflows).
Loading