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

Formatter deletes parenthesis around subqueries #36

Closed
aosokin opened this issue Oct 11, 2021 · 1 comment
Closed

Formatter deletes parenthesis around subqueries #36

aosokin opened this issue Oct 11, 2021 · 1 comment

Comments

@aosokin
Copy link

aosokin commented Oct 11, 2021

import mo_sql_parsing as msp
s = "SELECT count(*) FROM (SELECT city FROM airports GROUP BY city HAVING count(*)  >  3)"
d = msp.parse(s)
back = msp.format(d)
print(back)

This code produces SELECT COUNT(*) FROM SELECT city FROM airports GROUP BY city HAVING COUNT(*) > 3 where parenthesis disappear.

@klahnakoski
Copy link
Owner

Yesterday's work expanded the use of "precedence" to determine when parenthesis should be used. Now it is a matter of having enough tests to ensure I have the correct values set.

9978243#diff-77e357ea1ebd625dbc52532a43f82e67a856e499d3d0b1427b57a71c6f85056aR450

This issue was closed.
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

2 participants