Fix out of order execution on model select (#1354) #1355
Merged
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.
Fixes #1354
When we're removing nodes from the new graph we've constructed for the graph queue, replace all the removed transitive dependencies with explicit ones. The idea here is like this:
Imagine you have a DAG of models that is really boring and linear like: (A -> B -> C -> D)
And you've done
dbt run --model A D
. The old code would see a graph with those two nodes and no dependencies:The new code works like this:
A will now correctly execute before D.
Note that if B or C are early-binding views as in postgres/redshift default, this code will still fail, because the
drop ... cascade
when building A will drop B and C as well, and then D has no existing refs.