You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: website/docs/reference/node-selection/state-comparison-caveats.md
+20-3
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,16 @@ dbt will mark modified any resource that depends on a changed macro, or on a mac
16
16
17
17
### Vars
18
18
19
-
If a model uses a `var` or `env_var` in its definition, dbt is unable today to identify that lineage in such a way that it can include the model in `state:modified` because the `var` or `env_var` value has changed. It's likely that the model will be marked modified if the change in variable results in a different configuration.
19
+
<VersionBlocklastVersion="1.8">
20
+
21
+
If a model uses a `var` or `env_var` in its definition, dbt Core 1.8 and earlier are unable today to identify that lineage in such a way that it can include the model in `state:modified` because the `var` or `env_var` value has changed. It's likely that the model will be marked modified if the change in variable results in a different configuration.
22
+
</VersionBlock>
23
+
24
+
<VersionBlockfirstVersion="1.9">
25
+
26
+
Beginning in dbt Core 1.9, when you set the `state_modified_compare_vars`[behavior flag](/reference/global-configs/behavior-changes#behavior-change-flags) to `True` and a model uses a `var` or `env_var` in its definition, dbt will identify that lineage in such a way that it will include the model in `state:modified` when the `var` or `env_var` value has changed.
27
+
28
+
</VersionBlock>
20
29
21
30
### Tests
22
31
@@ -44,12 +53,19 @@ dbt test -s "state:modified" --exclude "test_name:relationships"
44
53
45
54
### False positives
46
55
56
+
<VersionBlockfirstVersion="1.9">
57
+
58
+
To reduce false positives during `state:modified` selection due to env-aware logic, you can set the `state_modified_compare_more_unrendered`[behavior flag](/reference/global-configs/behavior-changes#behavior-change-flags) to `True`.
59
+
60
+
</VersionBlock>
61
+
62
+
<VersionBlocklastVersion="1.8">
47
63
State comparison works by identifying discrepancies between two manifests. Those discrepancies could be the result of:
48
64
49
65
1. Changes made to a project in development
50
-
2. Env-aware logic that causes different behavior based on the `target`, env vars, etc.
66
+
2. Env-aware logic that causes different behavior based on the `target`, env vars, etc., which can be avoided if you upgrade to dbt Core 1.9 and set the `state_modified_compare_more_unrendered`[behavior flag](/reference/global-configs/behavior-changes#behavior-change-flags) to `True`.
51
67
52
-
State comparison detects env-aware config in `dbt_project.yml`. This target-based config registers as a modification:
68
+
State comparison detects env-aware config in `dbt_project.yml`. This target-based config won't register as a modification:
53
69
54
70
<Filename='dbt_project.yml'>
55
71
@@ -73,6 +89,7 @@ That means the following config—functionally identical to the snippet above—
73
89
materialized = ('table' if target.name == 'prod' else 'view')
0 commit comments