-
Notifications
You must be signed in to change notification settings - Fork 205
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
recursive sql / prql #25
Comments
Thanks for the issue @ledinscak What would the materialized SQL you'd want to output for that, approximately? |
this is simplest form of recursion it is one column with integers from 1 to 11
I took example from: https://medium.com/swlh/recursion-in-sql-explained-graphically-679f6a0f143b |
There is ANSI SQL standard for recursions, so I thought approach with functions could do very well here, this is of course simple arithmetic example, see on linked page examples with parent - child relations. Point is that select part is repeated two or even three times with different where filters. In simple example last select could have also been written as: |
My guess would be that we don't need recursion in the transpiler from PRQL to SQL initially. Though we should be open to it if people find good cases. I'm actually not familiar with recursion in SQL, maybe I haven't used the cool DBs that much. If there is SQL that does recursion then we should be able to produce it. The thing that would be helpful is the actual SQL that you'd like to produce (PRQL just produces SQL, it doesn't do anything with the data itself). If it's an important case, please feel free to put a PR in with an example of the SQL and an estimate of the PRQL that should produce it. Thanks @ledinscak |
Hello, I'm very interested how would you approach on solving recursions in prql, for instance how to rewrite this simple sql recursion:
love the idea of prql, best of luck!
The text was updated successfully, but these errors were encountered: