[Bug] The --empty
flag produces broken SQL when code has {{ref...}}
or {{source..}}
with an alias
#474
Closed
2 tasks done
Labels
feature:unit-tests
Issues related to built-in dbt unit testing functionality
pkg:dbt-spark
Issue affects dbt-spark
type:bug
Something isn't working as documented
Is this a new bug in dbt-core?
Current Behavior
If you have a dbt model that uses the
{{ref...}}
or{{source..}}
macro together with an alias, for example:and you try to run it with the
--empty
flag then the compiled SQL will have double aliasing, resulting in broken SQLExpected Behavior
The alias should not be changed as to not alter the script
Steps To Reproduce
Create a dbt model with a
{{ref...}}
macro and try to compile its code with the--empty
flag.Relevant log output
No response
Environment
Which database adapter are you using with dbt?
spark
Additional Context
There are 2 workarounds.
require_alias
beFalse
by default. It's in the .venv/lib/python3.11/site-packages/dbt/adapters/base/relation.py
file, line 51The text was updated successfully, but these errors were encountered: