Fix: Add workaround to ignore source dependency if fqn matches model#5492
Merged
Fix: Add workaround to ignore source dependency if fqn matches model#5492
Conversation
c7e6718 to
bccd583
Compare
izeigerman
reviewed
Oct 6, 2025
izeigerman
reviewed
Oct 6, 2025
izeigerman
approved these changes
Oct 6, 2025
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.
An idiom used in dbt projects is to define a model as both a model and a source to circumvent circular dependencies.
For example:
Model A uses model B to figure out the previous load time by the max timestamp
Model B uses Model A to know what timestamp it needs to fetch from without having to redo that expensive calculation
In this idiom, Model B can be defined also as a source. Model A can then call it using the
source()method, circumventing the circular dependency.However, it does also mean the developer has to make sure the table for Model B is created before Model A is called. Putting the
source()call in anis_incremental()block is one way to solve that. There are many more examples.The purpose of this fix is to not preclude developers from using the idiom, while also making them responsible for resolving the dependency prior to runtime. If the runtime behavior is not resolved, new environments will error when trying to run with a missing table.
If the source/model fqn collision was unintentional, we will no longer catch the circular dependency at load time. It will instead error at runt ime.