mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Fix for FTS virtual table counting error
This commit is contained in:
parent
56623e48da
commit
012fc7c5cd
1 changed files with 8 additions and 3 deletions
|
|
@ -929,9 +929,14 @@ class Datasette:
|
||||||
]
|
]
|
||||||
views = [v[0] for v in conn.execute('select name from sqlite_master where type = "view"')]
|
views = [v[0] for v in conn.execute('select name from sqlite_master where type = "view"')]
|
||||||
for table in table_names:
|
for table in table_names:
|
||||||
count = conn.execute(
|
try:
|
||||||
'select count(*) from {}'.format(escape_sqlite_table_name(table))
|
count = conn.execute(
|
||||||
).fetchone()[0]
|
'select count(*) from {}'.format(escape_sqlite_table_name(table))
|
||||||
|
).fetchone()[0]
|
||||||
|
except sqlite3.OperationalError:
|
||||||
|
# This can happen when running against a FTS virtual tables
|
||||||
|
# e.g. "select count(*) from some_fts;"
|
||||||
|
count = 0
|
||||||
label_column = None
|
label_column = None
|
||||||
# If table has two columns, one of which is ID, then label_column is the other one
|
# If table has two columns, one of which is ID, then label_column is the other one
|
||||||
column_names = [r[1] for r in conn.execute(
|
column_names = [r[1] for r in conn.execute(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue