Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clarify defer behavior #4435

Merged
merged 3 commits into from
Nov 13, 2023
Merged

clarify defer behavior #4435

merged 3 commits into from
Nov 13, 2023

Conversation

mirnawong1
Copy link
Contributor

@mirnawong1 mirnawong1 commented Nov 10, 2023

Sophia raised a great question about defer's behavior, which users were reaching out to.

adding this info to the docs so it's clear

@mirnawong1 mirnawong1 requested a review from a team as a code owner November 10, 2023 10:52
Copy link

vercel bot commented Nov 10, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-getdbt-com ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 13, 2023 9:34am

@github-actions github-actions bot added content Improvements or additions to content size: small This change will take 1 to 2 days to address Docs team Authored by the Docs team @dbt Labs labels Nov 10, 2023
@mirnawong1 mirnawong1 changed the title Mwong-clarify-defer clarify defer behavior Nov 10, 2023
@mirnawong1 mirnawong1 enabled auto-merge November 10, 2023 10:54
@sophiad96
Copy link
Contributor

Looks good to me!

@mirnawong1 mirnawong1 merged commit 7f8ac8c into current Nov 13, 2023
7 checks passed
@mirnawong1 mirnawong1 deleted the mwong-clarify-defer branch November 13, 2023 09:34
Both the dbt Cloud IDE and the dbt Cloud CLI allow users to natively defer to production metadata directly in their development workflows, dramatically reducing development time and warehouse spend by preventing unnecessary model builds.
By default, dbt follows these rules:

- Defers to the production environment when there's no development schema.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Defers to the production environment when there's no development schema.
- Resolves `{{ ref() }}` functions using the production locations for the parents of selected models using metadata from the production environment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • dbt uses the production locations of parent models to resolve {{ ref() }} functions, based on metadata from the production environment

By default, dbt follows these rules:

- Defers to the production environment when there's no development schema.
- If a development schema exists, dbt will prioritize those changes, which minimizes development time and avoids unnecessary model builds.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- If a development schema exists, dbt will prioritize those changes, which minimizes development time and avoids unnecessary model builds.
- If a development version of a deferred model exists, dbt preferentially use that table when resolving the reference.
- Passing the `--favor-state` flag will override this behavior, and _always_ resolve refs using the production metadata, regardless of the presence of a development relation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content Improvements or additions to content Docs team Authored by the Docs team @dbt Labs size: small This change will take 1 to 2 days to address
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants