-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Support contextual table aliasing #199
Comments
To anyone searching for a quick short term solution: |
facing the same issue any solution or progress here? we are planning to use --empty for CI |
We ended up wrapping some of our references that had an alias with parenthesis, we're using the dbt Athena plugin and it seems to be ok (albeit hacky). Eg
Which renders out as:
|
I'm running into the issue w/ dbt-databricks 1.8.7 (dbt-core 1.8.8). What I don't understand is why this needs an alias at all? If platforms like postgres require an alias, then won't the model already be written with an alias? Otherwise, it seems the model wouldn't work under normal conditions. UDPATE: I now realize this was for subqueries and that models written for a single table will often not use an alias. For some reason my brain filtered out "subqueries" and I inferred "all tables". |
Is this your first time submitting a feature request?
Describe the feature
Follow up from: #124
Currently in databases like postgres (at least pre v16) we attempt to inject subqueries with aliases. This can create a poor user experience as when they write something like:
and run with
--empty
, we produce something like:The duplicate aliases are invalid sql.
The challenge is that in order to know whether the ref already has an alias.
Describe alternatives you've considered
No response
Who will this benefit?
No response
Are you interested in contributing this feature?
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: