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:
1d4a2ab
)
Provide int types instead numpy types for allowing JSON encoding
author
Javier Sancho
<jsf@jsancho.org>
Tue, 15 May 2018 10:27:51 +0000
(12:27 +0200)
committer
Javier Sancho
<jsf@jsancho.org>
Tue, 15 May 2018 10:27:51 +0000
(12:27 +0200)
datasette_pytables/__init__.py
patch
|
blob
|
history
diff --git
a/datasette_pytables/__init__.py
b/datasette_pytables/__init__.py
index 217214f6f4d7ece9b9566e8018f85ee85c5ee47f..0bbb25f9cd63eb55c4ab37212984d0aaea1a221a 100644
(file)
--- a/
datasette_pytables/__init__.py
+++ b/
datasette_pytables/__init__.py
@@
-19,7
+19,7
@@
def inspect(path):
'name': table._v_pathname,
'columns': colnames,
'primary_keys': [],
'name': table._v_pathname,
'columns': colnames,
'primary_keys': [],
- 'count':
table.nrows
,
+ 'count':
int(table.nrows)
,
'label_column': None,
'hidden': False,
'fts_table': None,
'label_column': None,
'hidden': False,
'fts_table': None,
@@
-120,13
+120,13
@@
class Connection:
# Prepare rows
if len(fields) == 1 and fields[0] == 'count(*)':
# Prepare rows
if len(fields) == 1 and fields[0] == 'count(*)':
- rows.append(Row({fields[0]:
table.nrows
}))
+ rows.append(Row({fields[0]:
int(table.nrows)
}))
else:
for table_row in table_rows:
row = Row()
for field in fields:
if field == 'rowid':
else:
for table_row in table_rows:
row = Row()
for field in fields:
if field == 'rowid':
- row[field] =
table_row.nrow
+ row[field] =
int(table_row.nrow)
elif field == '*':
for col in table.colnames:
value = table_row[col]
elif field == '*':
for col in table.colnames:
value = table_row[col]