-
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
Using sqlparser-rs for SQL AST #97
Comments
* Functions to transform AST to CTEs This is not perfect code, but it's in a good enough state to merge. The next steps somewhat depend on #97
👋 hi @max-sixty -- I (biasedly) think sqlparser is high quality and fairly stable and likely to incrementally add support for new SQL features from the community I think many projects use sqlparser successfully, both directly like datafusion as well as fork sqlparser for their own use internally and occasionally contribute patches back upstream. The license is the liberal Apache license. The maintainers only have limited time to work on the project however, so changes in the core repo will likely remain on rounding out the SQL parsing support |
Thanks @alamb ! Can I ask a follow-up — we are trying to go the other direction — i.e. construct SQL queries from an AST (rather than parsing SQL) — do you think sqlparser is a good fit for that? Does running |
Yes I think it is a good fit
As long as the AST is an actual query then yes :) In fact many of the tests in sqlparser verify that parsing a sql string, and then |
That's great news! Thanks! |
We're getting to the point where we're converting PRQL AST to SQL AST, and then we'll need to convert the SQL AST to text.
sqlparser-rs is predominantly for parsing SQL — i.e. going the other direction.
But it has:
Display
implemented for this AST, which may do the writing for us; e.g. https://github.com/sqlparser-rs/sqlparser-rs/blob/main/src/ast/query.rs#L152-L195It looks excellent quality, something I think we'd love to build on.
This would be "huge if true" — so adding this issue to socialize the idea. I'll optimistically tag @alamb as they've been the main contributor to the repo very recently, in case they have a view.
The text was updated successfully, but these errors were encountered: