dbt-labs / dbt-labs/docs.getdbt.com

[Core] Describe what contributes to `state:modified` for each resource type

Open
#5,886 1 comment 0 reactions 0 assignees View on GitHub
content dbt Core size: medium
Dominant language
JavaScript
Stars
215
Forks
1.2k
Avg merge
1d 15h
Merged PRs (30d)
130

Description

### Link to the page(s) on docs.getdbt.com requiring updates

https://docs.getdbt.com/reference/node-selection/state-comparison-caveats

### Tell us more about this update

Folks will often want to understand why a change is or isn't included in [`state:modified`](https://docs.getdbt.com/reference/node-selection/methods#the-state-method).

It would be great if we documented which things contribute (and possible some examples of which don't).

### Reviewers/Stakeholders/SMEs

.

### Related GitHub issues

https://github.com/dbt-labs/dbt-adapters/issues/572

### Additional information

[`state:modified`](https://github.com/dbt-labs/dbt-core/blob/ff2726c3b59e52e1268d5b78ad59d0cf2453f409/core/dbt/graph/selector_methods.py#L745C14-L745C22) is determined by [`check_modified_content`](https://github.com/dbt-labs/dbt-core/blob/ff2726c3b59e52e1268d5b78ad59d0cf2453f409/core/dbt/graph/selector_methods.py#L680) which uses the definition of [`same_contents`](https://github.com/dbt-labs/dbt-core/blob/ff2726c3b59e52e1268d5b78ad59d0cf2453f409/core/dbt/contracts/graph/nodes.py#L360C5-L360C22) (which often varies by node type).

For example, a parsed node is considered modified if (and only if), one of the following has changed:
- body
- config
- **persisted** description
- fqn
- database representation
- contract

Models extend parsed nodes to also include:
- ref representation

But generic data tests use the the following criteria instead:
- config
- fqn

Unit tests use:
- checksum

Macros:
- macro sql

Documentation ("docs blocks"):
- block contents

Sources:
- database_representation
- fqn
- config
- quoting
- freshness
- external

Exposures:
- fqn
- exposure_type
- owner
- maturity
- url
- description
- label
- depends_on
- config

Metric:
- filter
- metadata
- type
- type params
- description
- label
- config

Semantic model:
- model
- description
- defaults
- entities
- dimensions
- measures
- config
- primary entity
- group

Saved query:
- metrics
- group by
- description
- where
- label
- config
- group
- exports

Any other properties not listed above are **not** taken into account as it relates to `state:modified`. For example, if a model using the `dbt-bigquery` adapter defines [`policy_tags`](https://docs.getdbt.com/reference/resource-configs/bigquery-configs#policy-tags) on one of its columns and then changes it subsequently, it will not affect the calculation of `state:modified`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.