]> git.jsancho.org Git - datasette-pytables.git/commitdiff
Fix entry point and some issues with sqlite glob operand
authorJavier Sancho <jsf@jsancho.org>
Tue, 24 Nov 2020 17:27:51 +0000 (18:27 +0100)
committerJavier Sancho <jsf@jsancho.org>
Tue, 24 Nov 2020 17:27:51 +0000 (18:27 +0100)
datasette_pytables/__init__.py
setup.py
tests/test_html.py

index 7b4d33c1b8ffc4c7d7bdb1392c1fbfa13d11d247..4c1cc0f9837aff45375c1f6c1654b8e71d359094 100644 (file)
@@ -122,6 +122,10 @@ class PyTablesConnector(dc.Connector):
         truncated = False
         description = ()
 
         truncated = False
         description = ()
 
+        # Some Datasette queries uses glob operand, not supported by Pytables
+        if ' glob ' in sql:
+            return results, truncated, description
+
         parsed_sql = parse_sql(sql, params)
 
         while isinstance(parsed_sql['from'], dict):
         parsed_sql = parse_sql(sql, params)
 
         while isinstance(parsed_sql['from'], dict):
@@ -231,8 +235,7 @@ class PyTablesConnector(dc.Connector):
 
         # Execute query
         if query:
 
         # Execute query
         if query:
-            if not ' glob ' in query:
-                table_rows = table.where(query, params, start, end)
+            table_rows = table.where(query, params, start, end)
         elif orderby:
             table_rows = table.itersorted(orderby, start=start, stop=end)
         else:
         elif orderby:
             table_rows = table.itersorted(orderby, start=start, stop=end)
         else:
index d6ef38ffb322ece293f2f48ff10bccb30fab398e..ff468632b49cf61cd7473c3069f1bf8d1edc570c 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -19,12 +19,13 @@ setup(
     long_description=get_long_description(),
     long_description_content_type='text/markdown',
     author='Javier Sancho',
     long_description=get_long_description(),
     long_description_content_type='text/markdown',
     author='Javier Sancho',
+    author_email='jsf@jsancho.org',
     url='https://github.com/jsancho-gpl/datasette-pytables',
     license='Apache License, Version 2.0',
     packages=['datasette_pytables'],
     entry_points={
         'datasette.connectors': [
     url='https://github.com/jsancho-gpl/datasette-pytables',
     license='Apache License, Version 2.0',
     packages=['datasette_pytables'],
     entry_points={
         'datasette.connectors': [
-            'pytables = datasette_pytables'
+            'pytables = datasette_pytables:PyTablesConnector'
         ],
     },
     install_requires=[
         ],
     },
     install_requires=[
index 3e1c9ed231717fe8461f10987d9b36c549ac9aa7..a545fe5ebe98db6d993859d7cb3d4cc58a90cf21 100644 (file)
@@ -26,3 +26,7 @@ def test_array(app_client):
 def test_array_row(app_client):
     response = app_client.get('/test_tables/%group1%array2/1050')
     assert response.status == 200
 def test_array_row(app_client):
     response = app_client.get('/test_tables/%group1%array2/1050')
     assert response.status == 200
+
+def test_table_exact_query(app_client):
+    response = app_client.get('/test_tables/%group2%table2/?idnumber__exact=0')
+    assert response.status == 200