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

Parse like and ilike clauses as comparisons #525

Merged
merged 6 commits into from
Jan 16, 2020

Conversation

dbczumar
Copy link
Contributor

This PR addresses #493 by introducing a regex filter to parse the following tokens as comparison operators, rather than keywords: LIKE, ILIKE, NOT LIKE, and NOT ILIKE. These terms are regarded as operators by popular SQL engines (e.g. Postgres, MySQL).

@andialbrecht There is a backwards-compatibility consideration here: reclassifying these terms as comparison operators may break preexisting user code that relies on the designation of the terms as keywords. Please let me know what your thoughts are here.

@andialbrecht
Copy link
Owner

@dbczumar thanks! The change looks good in general. Could you have another look at the test you've added? Travis reports a failure just for this test: https://travis-ci.org/andialbrecht/sqlparse/builds/629594200

@andialbrecht andialbrecht added this to the 0.3.1 milestone Dec 29, 2019
@t-henri t-henri mentioned this pull request Jan 3, 2020
22 tasks
@dbczumar
Copy link
Contributor Author

@andialbrecht Sorry for the delay - I've fixed the test (it required a bit of special casing in the test's validation logic because Comparison tokens do not define a ttype). Let me know how it looks!

@codecov-io
Copy link

codecov-io commented Jan 14, 2020

Codecov Report

Merging #525 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #525   +/-   ##
=======================================
  Coverage   96.95%   96.95%           
=======================================
  Files          21       21           
  Lines        1543     1543           
=======================================
  Hits         1496     1496           
  Misses         47       47
Impacted Files Coverage Δ
sqlparse/keywords.py 100% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a7d9ae7...8b01a9e. Read the comment docs.

@andialbrecht andialbrecht merged commit 6cab2ea into andialbrecht:master Jan 16, 2020
@andialbrecht
Copy link
Owner

Looks good, thanks a lot! This kind of "deep inspection" into the queries always requires some extra stuff... :)

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

Successfully merging this pull request may close these issues.

None yet

3 participants