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

make star macro work with CTEs #118

Closed
foundinblank opened this issue Feb 7, 2019 · 3 comments
Closed

make star macro work with CTEs #118

foundinblank opened this issue Feb 7, 2019 · 3 comments

Comments

@foundinblank
Copy link
Contributor

foundinblank commented Feb 7, 2019

So the star macro works great - but only with tables or views. It won't work for CTEs referenced within the same data model (.sql file).

@drewbanin's two ideas:

  1. executed the subquery with limit 0, inspecting the returned columns
  2. creating a view, inspecting the resulting columns

neither of those sound super appealing to me though 😕

Michael Kaminsky's idea:

DBT could create a view with limit 0, inspect the catalog, and then drop the view

@drewbanin
Copy link
Contributor

@foundinblank we'd need to make some pretty substantial changes in dbt core to support something like this! While I'm happy to leave this issue open to track the feature request, it's also not something that's prioritized for us in the near future.

Happy to chat about potential implementation here if you're interested, but really, the operative place for the issue is probably dbt-core i think

@foundinblank
Copy link
Contributor Author

phew, that serious? 😅 haha. okay, i'll copy/paste it over to dbt-core. don't expect this to get worked on anytime soon, just filing it for posterity.

@luutuankiet
Copy link

If this helps I wrote a basic macro over here, hopefully this keeps the ball rolling!

#996 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants