Skip to content

Commit

Permalink
Nfiann-manifest (#6933)
Browse files Browse the repository at this point in the history
  • Loading branch information
nataliefiann authored Mar 4, 2025
2 parents 9febf89 + 8aaf26b commit df19673
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,4 @@ Run `dbt --help` to see new & improved help documentation :)
- [Events and logging](/reference/events-logging): Added `node_relation` (`database`, `schema`, `identifier`) to the `node_info` dictionary, available on node-specific events
- Support setting `--project-dir` via environment variable: [`DBT_PROJECT_DIR`](/reference/dbt_project.yml)
- More granular configurations for logging (to set [log format](/reference/global-configs/logs#log-formatting), [log levels](/reference/global-configs/logs#log-level), and [colorization](/reference/global-configs/logs#color)) and [cache population](/reference/global-configs/cache#cache-population)
- [dbt overwrites the `manifest.json` file](/reference/node-selection/state-comparison-caveats#overwrites-the-manifestjson) during parsing, which means when you reference `--state` from the `target/ directory`, you may encounter a warning indicating that the saved manifest wasn't found.
12 changes: 12 additions & 0 deletions website/docs/reference/node-selection/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,18 @@ There are two additional `state` selectors that complement `state:new` and `stat
These selectors can help you shorten run times by excluding unchanged nodes. Currently, no subselectors are available at this time, but that might change as use cases evolve.
#### Overwrites the `manifest.json`
import Overwritesthemanifest from '/snippets/_overwrites-the-manifest.md';
<Overwritesthemanifest />
#### Recommendation
import Recommendationoverwritesthemanifest from '/snippets/_recommendation-overwriting-manifest.md';
<Recommendationoverwritesthemanifest />
### tag
The `tag:` method is used to select models that match a specified [tag](/reference/resource-configs/tags).
Expand Down
11 changes: 11 additions & 0 deletions website/docs/reference/node-selection/state-comparison-caveats.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ If you're a frequent user of `relationships` tests or data tests, or frequently
dbt run -s "state:modified"
dbt test -s "state:modified" --exclude "test_name:relationships"
```
### Overwrites the `manifest.json`

import Overwritesthemanifest from '/snippets/_overwrites-the-manifest.md';

<Overwritesthemanifest />

#### Recommendation

import Recommendationoverwritesthemanifest from '/snippets/_recommendation-overwriting-manifest.md';

<Recommendationoverwritesthemanifest />

### False positives

Expand Down
1 change: 1 addition & 0 deletions website/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions website/snippets/_overwrites-the-manifest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dbt overwrites the `manifest.json` file during parsing, which means when you reference `--state` from the `target/ directory`, you may encounter a warning indicating that the saved manifest wasn't found.

<Lightbox src="/img/docs/reference/saved-manifest-not-found.png" title="Saved manifest not found error" />

During the next job run, dbt follows a sequence of steps that lead to the issue. First, it overwrites `target/manifest.json` before it can be used for change detection. Then, when dbt tries to read `target/manifest.json` again to detect changes, it finds none because the previous state has already been overwritten/erased.

Avoid setting `--state` and `--target-path` to the same path with state-dependent features like `--defer` and `state:modified` as it can lead to non-idempotent behavior and won't work as expected.
7 changes: 7 additions & 0 deletions website/snippets/_recommendation-overwriting-manifest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
To prevent the `manifest.json` from being overwritten before dbt reads it for change detection, update your workflow using one of these methods:

- Move the `manifest.json` to a dedicated folder (for example `state/`) after dbt generates it in the `target/ folder`. This makes sure dbt references the correct saved state instead of comparing the current state with the just-overwritten version. It also avoids issues caused by setting `--state` and `--target-path` to the same location, which can lead to non-idempotent behavior.


- Write the manifest to a different `--target-path` in the build stage (where dbt would generate the `target/manifest.json`) or before it gets overwritten during job execution to avoid issues with change detection. This allows dbt to detect changes instead of comparing the current state with the just-overwritten version.
- Pass the `--no-write-json` flag: `dbt --no-write-json ls --select state:modified --state target`: during the reproduction stage.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit df19673

Please sign in to comment.