Skip to main content

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-id to the dbt-cloud block in dbt_project.yml. Refer to Configure Cloud CLI for more information.

    dbt_project.yml
    dbt-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_target in profiles.yml for best-effort auto-deferral. Note that this approach has known limitations; refer to Caveats to dbt State without a manifest.

    profiles.yml
    my_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.

note

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-id to identify which project dbt State should use.

    dbt_project.yml
    dbt-cloud:
    project-id: <your-project-id>
  • For self-managed deployments with multiple dbt State orgs: Add state-org-id to identify which org dbt State should use.

    dbt_project.yml
    dbt-cloud:
    state-org-id: <your-org-id>

Was this page helpful?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

0
Loading