kayak / pypika

PyPika is a python SQL query builder that exposes the full richness of the SQL language using a syntax that reflects the resulting query. PyPika excels at all sorts of SQL queries but is especially useful for data analysis.
http://pypika.readthedocs.io/en/latest/
Apache License 2.0
2.5k stars 295 forks source link

Make MySQL queries wrap set operations with parens #782

Closed pandaxtc closed 5 months ago

pandaxtc commented 9 months ago

Add parens around set operations for MySQL. Fixes https://github.com/kayak/pypika/issues/773.

Note that I removed the tests for checking no parens for MySQL, since adding back the parens brings the behavior in line with the default. I assume the tests are for checking that the behavior is not default. Let me know if the tests should be added back.

wd60622 commented 9 months ago

I'm not fully versed on the test suite, but it might be best to test that the union now has parentheses instead of deleting the previous test. No harm in double checking

pandaxtc commented 9 months ago

Gotcha, just added the tests back.

wd60622 commented 8 months ago

@AzisK Could you run the test suite?

coveralls commented 8 months ago

Coverage Status

coverage: 98.39%. remained the same when pulling 1e797c73daff68cb8b3f216c0b7c5a07689b41d3 on pandaxtc:pandaxtc/fix-mysql-set-wrap into 8841520e906970d76c5ed81c7dd5d154f0d5259d on kayak:master.

danielenricocahall commented 5 months ago

@AzisK I hope all is going well! Would we be able to get this in as well? Looks like a small, useful change to include in a release if one is anticipated soon. 😄

AzisK commented 5 months ago

Looks good to me