projects
/
datasette-pytables.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6e8ac54
)
Fix problems with arrays
author
Javier Sancho
<jsf@jsancho.org>
Fri, 25 May 2018 11:25:16 +0000
(13:25 +0200)
committer
Javier Sancho
<jsf@jsancho.org>
Fri, 25 May 2018 11:25:16 +0000
(13:25 +0200)
datasette_pytables/__init__.py
patch
|
blob
|
history
diff --git
a/datasette_pytables/__init__.py
b/datasette_pytables/__init__.py
index 93cc1f082fd6eef31e0250ef644080cf4474303c..d16109b541d106447ab22964d3a20beffd74d60e 100644
(file)
--- a/
datasette_pytables/__init__.py
+++ b/
datasette_pytables/__init__.py
@@
-94,7
+94,10
@@
class Connection:
# Use 'where' statement or get all the rows
def _cast_param(field, pname):
# Cast value to the column type
# Use 'where' statement or get all the rows
def _cast_param(field, pname):
# Cast value to the column type
- coltype = table.coltypes[field]
+ if type(table) is tables.table.Table:
+ coltype = table.coltypes[field]
+ else:
+ coltype = table.dtype.name
fcast = None
if coltype == 'string':
fcast = str
fcast = None
if coltype == 'string':
fcast = str
@@
-107,6
+110,7
@@
class Connection:
def _translate_where(where):
# Translate SQL to PyTables expression
def _translate_where(where):
# Translate SQL to PyTables expression
+ nonlocal start, end
expr = ''
operator = list(where)[0]
expr = ''
operator = list(where)[0]
@@
-118,9
+122,10
@@
class Connection:
elif operator == 'exists':
pass
elif where == {'eq': ['rowid', 'p0']}:
elif operator == 'exists':
pass
elif where == {'eq': ['rowid', 'p0']}:
- nonlocal start, end
start = int(params['p0'])
end = start + 1
start = int(params['p0'])
end = start + 1
+ elif where == {'gt': ['rowid', 'p0']}:
+ start = int(params['p0']) + 1
else:
left, right = where[operator]
if left in params:
else:
left, right = where[operator]
if left in params: