-
Notifications
You must be signed in to change notification settings - Fork 39
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
Always ensure valid incremental strategy #331
Merged
mikealfare
merged 7 commits into
main
from
qmalcolm--330-always-ensure-valid-materialization
Oct 18, 2024
Merged
Always ensure valid incremental strategy #331
mikealfare
merged 7 commits into
main
from
qmalcolm--330-always-ensure-valid-materialization
Oct 18, 2024
Conversation
This file contains 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
Right now, this test will fail. That is because the fix will be in the next commit. Presently if an incremental model is being built for the first time (because the relation in the data warehouse doesn't exist) or if the incremental model is being run as a full refresh, then validation that the incremental strategy _doesn't happen_. Technically for _most_ incremental strategies, this is "okay" because the incremental strategy isn't used when creating the relation for the first time or during full refresh. The exception is the microbatch strategy, which is part of the problem. The other part of the problem is that this leads to an experience where if you write up an incremental model (with an invalid strategy) and then run it to ensure it works, you won't know anything is wrong until it is run for the second time.
Merged
4 tasks
mikealfare
reviewed
Oct 16, 2024
QMalcolm
added a commit
to dbt-labs/dbt-postgres
that referenced
this pull request
Oct 17, 2024
…rs dependencies This is necessary because the changes we are making in dbt-adapters via dbt-labs/dbt-adapters#331 only get tested when run with an adapter. So this branch on dbt-postgres is not just for ensuring the test is run, but also proof for the open PR in dbt-adapters that the tests work. To show that though, we have to update the dependencies to temporarily point at the dbt-adapters branch that has the work (because the work hasn't been merged to main yet)
mikealfare
approved these changes
Oct 18, 2024
mikealfare
deleted the
qmalcolm--330-always-ensure-valid-materialization
branch
October 18, 2024 03:45
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 #330
Problem
Previously if you set an invalid
incremental_strategy
for an incremental model, it'll succeed on the first run, and then fail on the second runI.e. if you have
That was always succeeding when the model was either built for the first time or rebuilt via --full-refresh. You only got an error about the strategy the next time the model was run.
Solution
Change the order of operations in
incremental.sql
to ensure that a incremental model'sincremental_strategy
is always validatedChecklist