X-Git-Url: https://git.jsancho.org/?p=datasette-pytables.git;a=blobdiff_plain;f=datasette_pytables%2F__init__.py;h=1cb22a8c2b03f379fa7d9226040abd51c0469197;hp=9cb90051037c91770f7b10af62dc7ea21435e5e1;hb=e89b45df6d33c14e0f23915fd02e9c0c753dc588;hpb=a408f0f468266f9b647e8572babda08fe9e0e09c diff --git a/datasette_pytables/__init__.py b/datasette_pytables/__init__.py index 9cb9005..1cb22a8 100644 --- a/datasette_pytables/__init__.py +++ b/datasette_pytables/__init__.py @@ -198,6 +198,11 @@ class PyTablesConnector(dc.Connector): if 'limit' in parsed_sql: limit = int(parsed_sql['limit']) + # Offset + offset = None + if 'offset' in parsed_sql: + offset = int(parsed_sql['offset']) + # Truncate if needed if page_size and max_returned_rows and truncate: if max_returned_rows == page_size: @@ -245,6 +250,8 @@ class PyTablesConnector(dc.Connector): # Get results get_rowid = make_get_rowid() get_row_value = make_get_row_value() + if offset: + table_rows = table_rows[offset:] count = 0 for table_row in table_rows: count += 1 @@ -270,7 +277,7 @@ class PyTablesConnector(dc.Connector): row['count(*)'] = int(table.nrows) elif field_name.get('json_type'): field_name = field_name.get('json_type') - row['json_type(' + field_name + ')'] = _get_field_type(field) + row['json_type(' + field_name + ')'] = _get_field_type(field_name) else: raise Exception("Function not recognized") else: