From f0b86608911b477157a96d73be95f3ac368b5e29 Mon Sep 17 00:00:00 2001 From: Matt Shaver <60105315+matthewshaver@users.noreply.github.com> Date: Tue, 4 Apr 2023 11:27:13 -0400 Subject: [PATCH 1/2] Updates to env var names --- website/docs/docs/deploy/about-state.md | 17 ++++++++++++ .../versions/02-upgrading-to-v1.5.md | 11 ++++++++ website/docs/reference/global-configs.md | 25 ++++++++++++++++++ .../docs/reference/node-selection/defer.md | 10 +++++++ .../docs/reference/node-selection/methods.md | 26 +++++++++++++++++++ 5 files changed, 89 insertions(+) diff --git a/website/docs/docs/deploy/about-state.md b/website/docs/docs/deploy/about-state.md index b8d4092dcce..440f4c6a1ab 100644 --- a/website/docs/docs/deploy/about-state.md +++ b/website/docs/docs/deploy/about-state.md @@ -26,9 +26,26 @@ Together, these two features enable ["slim CI"](best-practices#run-only-modified State and defer can be set by environment variables as well as CLI flags: + + - `--state` or `DBT_ARTIFACT_STATE_PATH`: file path - `--defer` or `DBT_DEFER_TO_STATE`: boolean + + + + +- `--state` or `DBT_STATE`: file path +- `--defer` or `DBT_DEFER`: boolean + +:::warning Syntax deprecated + +The original syntax for state (`DBT_ARTIFACT_STATE_PATH`) and defer (`DBT_DEFER_TO_STATE`) have been deprecated in dbt v1.5. Backward compatibility is supported in this version but will be removed in an as-of-yet-undetermined future release. + +::: + + + If both the flag and env var are provided, the flag takes precedence. #### Notes: diff --git a/website/docs/guides/migration/versions/02-upgrading-to-v1.5.md b/website/docs/guides/migration/versions/02-upgrading-to-v1.5.md index 3cac3fd346d..de4a3acb93d 100644 --- a/website/docs/guides/migration/versions/02-upgrading-to-v1.5.md +++ b/website/docs/guides/migration/versions/02-upgrading-to-v1.5.md @@ -46,6 +46,17 @@ The manifest schema version will be updated to `v9`. Specific changes: - Addition of `access` as a top-level node config for models - Addition of `group` and `contract` as node configs +### For users of env vars + +The following env vars have been renamed: + +- `DBT_DEFER_TO_STATE` → `DBT_DEFER` +- `DBT_FAVOR_STATE_MODE` → `DBT_FAVOR_STATE` +- `DBT_NO_PRINT` → `DBT_PRINT` +- `DBT_ARTIFACT_STATE_PATH` → `DBT_STATE` + +Backward compatibility with the old syntax is still supported but will be removed in an as-of-yet-undetermined future released. + ### For maintainers of adapter plugins For more detailed information and to ask any questions, please visit [dbt-core/discussions/6624](https://github.com/dbt-labs/dbt-core/discussions/6624). diff --git a/website/docs/reference/global-configs.md b/website/docs/reference/global-configs.md index 222c89c09d0..05541efdf95 100644 --- a/website/docs/reference/global-configs.md +++ b/website/docs/reference/global-configs.md @@ -356,6 +356,8 @@ $ dbt --quiet run ### Suppress `print()` messages in stdout + + By default, dbt includes `print()` messages in standard out (stdout). You can use the `NO_PRINT` config to prevent these messages from showing up in stdout. @@ -367,6 +369,29 @@ config: + + + + +By default, dbt includes `print()` messages in standard out (stdout). You can use the `PRINT` config to prevent these messages from showing up in stdout. + + + +```yaml +config: + print: false +``` + + + +:::warning Syntax deprecation + +The original `NO_PRINT` syntax has been deprecated, starting with dbt v1.5. Backward compatibility is supported but will be removed in an as-of-yet-undetermined future release. + +::: + + + Supply `--no-print` flag to `dbt run` to suppress `print()` messages from showing in stdout. ```text diff --git a/website/docs/reference/node-selection/defer.md b/website/docs/reference/node-selection/defer.md index 59d63b6aea2..237915c48e6 100644 --- a/website/docs/reference/node-selection/defer.md +++ b/website/docs/reference/node-selection/defer.md @@ -43,8 +43,18 @@ When using defer, you may be selecting from production datasets, development dat - if you apply env-specific limits in dev but not prod, as you may end up selecting more data than you expect - when executing tests that depend on multiple parents (e.g. `relationships`), since you're testing "across" environments + + Deferral requires both `--defer` and `--state` to be set, either by passing flags explicitly or by setting environment variables (`DBT_DEFER_TO_STATE` and `DBT_ARTIFACT_STATE_PATH`). If you use dbt Cloud, read about [how to set up CI jobs](/docs/deploy/cloud-ci-job). + + + + +Deferral requires both `--defer` and `--state` to be set, either by passing flags explicitly or by setting environment variables (`DBT_DEFER` and `DBT_STATE`). If you use dbt Cloud, read about [how to set up CI jobs](/docs/deploy/cloud-ci-job). + + + #### Favor state diff --git a/website/docs/reference/node-selection/methods.md b/website/docs/reference/node-selection/methods.md index 7913e4688aa..794749f5b94 100644 --- a/website/docs/reference/node-selection/methods.md +++ b/website/docs/reference/node-selection/methods.md @@ -143,8 +143,18 @@ that defines it. For more information about how generic tests are defined, read **N.B.** State-based selection is a powerful, complex feature. Read about [known caveats and limitations](node-selection/state-comparison-caveats) to state comparison. + + The `state` method is used to select nodes by comparing them against a previous version of the same project, which is represented by a [manifest](artifacts/manifest-json). The file path of the comparison manifest _must_ be specified via the `--state` flag or `DBT_ARTIFACT_STATE_PATH` environment variable. + + + + +The `state` method is used to select nodes by comparing them against a previous version of the same project, which is represented by a [manifest](artifacts/manifest-json). The file path of the comparison manifest _must_ be specified via the `--state` flag or `DBT_STATE` environment variable. + + + `state:new`: There is no node with the same `unique_id` in the comparison manifest `state:modified`: All new nodes, plus any changes to existing nodes. @@ -222,11 +232,27 @@ The following dbt commands produce `sources.json` artifacts whose results can be 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 ``` + + + + + +```bash +# You can also set the DBT_STATE 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 +``` + + + + From cbbf02df0a5746f332f85c6ce2a8dd05226b22ad Mon Sep 17 00:00:00 2001 From: Matt Shaver <60105315+matthewshaver@users.noreply.github.com> Date: Wed, 5 Apr 2023 09:41:08 -0400 Subject: [PATCH 2/2] Update website/docs/docs/deploy/about-state.md Co-authored-by: mirnawong1 <89008547+mirnawong1@users.noreply.github.com> --- website/docs/docs/deploy/about-state.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/docs/deploy/about-state.md b/website/docs/docs/deploy/about-state.md index 440f4c6a1ab..83151df93c6 100644 --- a/website/docs/docs/deploy/about-state.md +++ b/website/docs/docs/deploy/about-state.md @@ -40,7 +40,7 @@ State and defer can be set by environment variables as well as CLI flags: :::warning Syntax deprecated -The original syntax for state (`DBT_ARTIFACT_STATE_PATH`) and defer (`DBT_DEFER_TO_STATE`) have been deprecated in dbt v1.5. Backward compatibility is supported in this version but will be removed in an as-of-yet-undetermined future release. +In dbt v1.5, we deprecated the original syntax for state (`DBT_ARTIFACT_STATE_PATH`) and defer (`DBT_DEFER_TO_STATE`). Although dbt supports backward compatibility with the old syntax, we will remove it in a future release that we have not yet determined. :::