Skip to content
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

Open
3 tasks done
colin-rogers-dbt opened this issue May 7, 2024 · 2 comments
Open
3 tasks done

[Feature] Support contextual table aliasing #199

colin-rogers-dbt opened this issue May 7, 2024 · 2 comments
Labels
empty Issues related to the --empty CLI flag enhancement New feature or request

Comments

@colin-rogers-dbt
Copy link
Contributor

colin-rogers-dbt commented May 7, 2024

Is this your first time submitting a feature request?

  • I have read the expectations for open source contributors
  • I have searched the existing issues, and I could not find an existing issue for this feature
  • I am requesting a straightforward extension of existing dbt-adapter functionality, rather than a Big Idea better suited to a discussion

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:

select * from {{ source('my_table') }} as my_source where x=y 

and run with --empty, we produce something like:

select * from {{ source('my_table') }} as _dbt_limit_subq as my_source where x=y 

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

@igorvoltaic
Copy link

igorvoltaic commented Sep 1, 2024

To anyone searching for a quick short term solution:
We used a dirty hack to run our pipelines with --empty. We parse our sql after it compiles here and remove double aliases where it breaks our code.

@gajanand-jm
Copy link

facing the same issue

any solution or progress here? we are planning to use --empty for CI

@dbeatty10 dbeatty10 added the empty Issues related to the --empty CLI flag label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
empty Issues related to the --empty CLI flag enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants