X-Git-Url: https://git.jsancho.org/?p=datasette-pytables.git;a=blobdiff_plain;f=datasette_pytables%2F__init__.py;h=6e34774bc24e83688571fcac6645741a9c98ba28;hp=4a7c5c8c3e83af5c4ef5a1f35f97f64b84b2bb63;hb=31f57a6c3e8cf26430cebdb091ca52c1fe6d66ac;hpb=06bdd1ac2d8836a2ab8e14074f2435a4c3a595b5 diff --git a/datasette_pytables/__init__.py b/datasette_pytables/__init__.py index 4a7c5c8..6e34774 100644 --- a/datasette_pytables/__init__.py +++ b/datasette_pytables/__init__.py @@ -41,12 +41,12 @@ def _parse_sql(sql, params): parsed = parse(sql) except: # Propably it's a PyTables expression - for token in ['group by', 'order by', 'limit']: + for token in ['group by', 'order by', 'limit', '']: res = re.search('(?i)where (.*)' + token, sql) if res: modified_sql = re.sub('(?i)where (.*)(' + token + ')', '\g<2>', sql) parsed = parse(modified_sql) - parsed['where'] = res.group(1) + parsed['where'] = res.group(1).strip() break # Always a list of fields