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:
b1fff46
)
Show field names in create sql
author
Javier Sancho
<jsf@jsancho.org>
Wed, 30 May 2018 10:13:30 +0000
(12:13 +0200)
committer
Javier Sancho
<jsf@jsancho.org>
Wed, 30 May 2018 10:13:30 +0000
(12:13 +0200)
datasette_pytables/__init__.py
patch
|
blob
|
history
diff --git
a/datasette_pytables/__init__.py
b/datasette_pytables/__init__.py
index 7bbc7c14063b5a562cb080c72609ccdf062fc9b2..58fee10364d3fec5c83d5b011579555f8d492712 100644
(file)
--- a/
datasette_pytables/__init__.py
+++ b/
datasette_pytables/__init__.py
@@
-240,8
+240,11
@@
class Connection:
elif sql == 'select sql from sqlite_master where name = :n and type="table"':
try:
table = self.h5file.get_node(params['n'])
+ colnames = ['value']
+ if type(table) is tables.table.Table:
+ colnames = table.colnames
row = Row()
- row['sql'] = 'CREATE TABLE {} (
)'.format(params['n']
)
+ row['sql'] = 'CREATE TABLE {} (
{})'.format(params['n'], ", ".join(colnames)
)
return [row]
except:
return []