[Bug] Duplication of CTEs during unit tests when two referenced models have the same custom alias
#10740
Open
2 tasks done
Labels
Originally posted by @yonatan-cohen8186 in #10728 (comment):
Is this a new bug in dbt-core?
Current Behavior
When a model being unit tested has two upstream models that both have the same database identifier, then there is a SQL error like the following when running the unit test:
There are a couple ways the same database identifier can come about:
I didn't check one way or the other for cross-project references, but that could be another case this might come about.
Expected Behavior
Each given model should have its own CTE, and those CTE should have unique names from each other.
A different way to consider this:
Steps To Reproduce
Create these files:
models/my_upstream_model_a.sql
models/my_upstream_model_b.sql
models/my_model.sql
models/_unit_tests.sql
Run these commands:
Relevant log output
Environment
Which database adapter are you using with dbt?
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: