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

Adding new state selectors #3596

Merged
merged 10 commits into from
Jul 6, 2023
12 changes: 11 additions & 1 deletion website/docs/reference/node-selection/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ The `state` method is used to select nodes by comparing them against a previous

</VersionBlock>

`state:new`: There is no node with the same `unique_id` in the comparison manifest
`state:new`: There is no node with the same `unique_id` in the comparison manifest.
matthewshaver marked this conversation as resolved.
Show resolved Hide resolved

`state:modified`: All new nodes, plus any changes to existing nodes.

Expand All @@ -200,6 +200,16 @@ Because state comparison is complex, and everyone's project is different, dbt su

Remember that `state:modified` includes _all_ of the criteria above, as well as some extra resource-specific criteria, such as modifying a source's `freshness` or `quoting` rules or an exposure's `maturity` property. (View the source code for the full set of checks used when comparing [sources](https://github.com/dbt-labs/dbt-core/blob/9e796671dd55d4781284d36c035d1db19641cd80/core/dbt/contracts/graph/parsed.py#L660-L681), [exposures](https://github.com/dbt-labs/dbt-core/blob/9e796671dd55d4781284d36c035d1db19641cd80/core/dbt/contracts/graph/parsed.py#L768-L783), and [executable nodes](https://github.com/dbt-labs/dbt-core/blob/9e796671dd55d4781284d36c035d1db19641cd80/core/dbt/contracts/graph/parsed.py#L319-L330).)

<VersionBlock firstVersion="1.6">

There are two additional `state` selectors that complement `state:new` and `state:modified` by representing the inverse of those functions:
- `state:old`: a node with the same `unique_id` exists in the comparison manifest
matthewshaver marked this conversation as resolved.
Show resolved Hide resolved
- `state:unmodified`: All existing nodes with no changes
matthewshaver marked this conversation as resolved.
Show resolved Hide resolved

The benefits for these selectors are primarily to exclude unchanged nodes to shorten run times. There are no subselectors available, but that may change as use cases evolve.
matthewshaver marked this conversation as resolved.
Show resolved Hide resolved

</VersionBlock>

### The "exposure" method

The `exposure` method is used to select parent resources of a specified [exposure](/docs/build/exposures). Use in conjunction with the `+` operator.
Expand Down