Configuring deferral in dbt State Preview
By default, dbt State defers to your production environment. Both sections on this page are optional; configure them if you want to customize the defaults.
Configure deferral
By default, dbt State defers to your production environment. You only need to configure this if you want to change that behavior:
-
dbt platform: To defer to an environment other than the default (for example, staging), add
defer-env-idto thedbt-cloudblock indbt_project.yml. Refer to Configure Cloud CLI for more information.dbt_project.ymldbt-cloud:
project-id: <your-project-id>
defer-env-id: <your-environment-id> -
Self-managed deployments: If you can't access a production or deployment manifest, you can set
defer_to_targetinprofiles.ymlfor best-effort auto-deferral. Note that this approach has known limitations; refer to Caveats to dbt State without a manifest.profiles.ymlmy_project:
outputs:
uat:
type: snowflake
# ... connection settings
defer_to_target: staging
You can also pass --state or --defer-state to explicitly point dbt State to a specific manifest.json.
If you've overridden generate_*_name() macros with runtime values (such as environment variables, file paths, or dates), provide a manifest.json file so dbt State can locate objects correctly. Without one, it infers object locations from your macros and profile target, which may be incorrect in these cases. Refer to Caveats to dbt State without a manifest.
Specify your project or org
If you have multiple projects or orgs that use dbt State, configure the dbt-cloud block in dbt_project.yml so dbt State knows which one to use:
-
For dbt platform users with multiple projects: Add
project-idto identify which project dbt State should use.dbt_project.ymldbt-cloud:
project-id: <your-project-id> -
For self-managed deployments with multiple dbt State orgs: Add
state-org-idto identify which org dbt State should use.dbt_project.ymldbt-cloud:
state-org-id: <your-org-id>
Related docs
Was this page helpful?
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.