Skip to content

Commit

Permalink
Merging syntax sections
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewshaver committed Aug 6, 2024
1 parent bcc9b8b commit 59dca3d
Showing 1 changed file with 3 additions and 17 deletions.
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.
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:
- `dbt source freshness`

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:

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

0 comments on commit 59dca3d

Please sign in to comment.