dcmoura / spyql

Query data on the command line with SQL-like SELECTs powered by Python expressions
https://spyql.readthedocs.io
MIT License
918 stars 25 forks source link

LIKE clause #67

Closed ricardocchaves closed 1 year ago

ricardocchaves commented 2 years ago

Adds a LIKE function to the WHERE clause for easier matching. Closes #17

Some notes

Future work

Either in the scope of this PR or in a future one, it is still missing other basic matching functions, like _ for single character matching or [] to specify a range.

ricardocchaves commented 2 years ago

How can I get a syntax error like the following:

$ python spyql 'SELECT * from range(3) WHERE'
ERROR   could not compile FROM clause
  File "<from>", line 1
    range(3) WHERE
                 ^
SyntaxError: unexpected EOF while parsing

But for LIKE? Should I change this or can it be kept as is? Desired output / behavior:

$ python spyql 'SELECT * from range(3) WHERE col1 LIKE'
ERROR   could not compile WHERE clause
  File "<from>", line 1
    col1 LIKE
            ^
SyntaxError: unexpected EOF while parsing

Current:

$ python spyql 'SELECT * from range(3) WHERE col1 LIKE'
ERROR   col1 LIKE
SyntaxError: unexpected EOF while parsing
codecov[bot] commented 2 years ago

Codecov Report

Merging #67 (0e0a830) into master (c379afa) will increase coverage by 0.07%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #67      +/-   ##
==========================================
+ Coverage   95.91%   95.98%   +0.07%     
==========================================
  Files          10       10              
  Lines        1076     1096      +20     
==========================================
+ Hits         1032     1052      +20     
  Misses         44       44              
Impacted Files Coverage Δ
spyql/cli.py 99.06% <100.00%> (+0.08%) :arrow_up:
spyql/quotes_handler.py 97.29% <100.00%> (+0.15%) :arrow_up:

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 c379afa...0e0a830. Read the comment docs.

ricardocchaves commented 2 years ago

As discussed offline:

dcmoura commented 1 year ago

Archiving due to lack of activity. Happy to reopen when you are ready!