[Bug] Incorrect CTE name in unit tests using incremental
mode for incremental models with a custom alias
#312
Labels
bug
Something isn't working
duplicate
This issue or pull request already exists
incremental
Incremental modeling with dbt
unit tests
Issues related to built-in dbt unit testing functionality
Is this a new bug?
Current Behavior
As originally reported by @jtstults-w in dbt-labs/dbt-core#10728 (comment):
The SQL for the unit test is not able to execute -- it fails with a "Table with name __dbt__cte__my_model does not exist!" error.
The erroneous SQL generally looks like this:
Note the mismatch between the CTE named
__dbt__cte__my_model_alias
and the reference in the where clause to CTE__dbt__cte__my_model
💥Expected Behavior
The SQL for the unit test is able to execute.
Steps To Reproduce
Reprex
Create these files:
models/my_model.sql
models/_properties.yml
Run these commands:
Relevant log output
Environment
Additional Context
This scenario is really similar to dbt-labs/dbt-core#10763 but with a custom model
alias
rather than a model version. Might be the same underlying issue.The text was updated successfully, but these errors were encountered: