feat: add --no-full-refresh flag to dbt compile#12628
Open
dtaniwaki wants to merge 1 commit intodbt-labs:mainfrom
Open
feat: add --no-full-refresh flag to dbt compile#12628dtaniwaki wants to merge 1 commit intodbt-labs:mainfrom
dtaniwaki wants to merge 1 commit intodbt-labs:mainfrom
Conversation
Contributor
|
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide. |
1623d73 to
f2fd732
Compare
3 tasks
Signed-off-by: Daisuke Taniwaki <daisuketaniwaki@gmail.com>
f2fd732 to
2b60482
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #10918
Thanks for maintaining dbt-core! I'd appreciate a review on this small addition.
Problem
When compiling incremental models with
dbt compile,is_incremental()always returnsFalsebecause it requires the target relation to exist in the database. This makes it impossible to inspect the incremental SQL path (e.g., for linting with SQLFluff or dry-run validation in CI) without actually running the model.Setting
full_refresh: falsein model config does not help here — even with that config,is_incremental()returnsFalseif the table doesn't exist yet.Solution
Add a
--no-full-refreshflag todbt compilethat forcesis_incremental()to returnTrueduring compilation, without querying the database. This is compile-only and intentionally not available fordbt run, where the absence of the target relation would cause execution to fail.Also available via environment variable:
The implementation follows the same pattern used by microbatch, which injects
is_incremental = lambda: Trueinto the Jinja context.Checklist