[Bug] --empty
flag causes syntax errors when source CTE uses ref name as prefix
#11149
Closed
2 tasks done
Is this a new bug in dbt-core?
Current Behavior
I am looking to use the
--empty
flag to do basic syntax/schema testing of DBT models in our project but I am running into an issue where references to the model name (i.e. as a column prefix) are broken due to the way in which the limit 0 is applied in a subquery without an alias.Expected Behavior
I would expect that when the
--empty
flag is used, a table alias of the original model name is supplied after the empty subquery to preserve references to the model name. For example of desired behavior see example below inSteps To Reproduce
Steps To Reproduce
Running with DBT in any environment (Redshift for us) with package versions below
Given a DBT SQL model below (test_model.sql)
Running
dbt compile --select test_model --empty
yields the following sqlWhen executed this SQL returns a syntax error:
I would like for the
--empty
flag to also include a table alias after the subquery to preserve references. Example compiled SQL below:Relevant log output
No response
Environment
Which database adapter are you using with dbt?
redshift
Additional Context
No response
The text was updated successfully, but these errors were encountered: