From 31f57a6c3e8cf26430cebdb091ca52c1fe6d66ac Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Wed, 23 May 2018 12:08:51 +0200 Subject: [PATCH] Parse PyTables expressions without group/order/limit keywords in the query --- datasette_pytables/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- 2.39.2