mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Fix for no such table: pragma_database_list, refs #1276
This commit is contained in:
parent
3fcfc85134
commit
48d5e0e6ac
1 changed files with 6 additions and 4 deletions
|
|
@ -247,10 +247,12 @@ class Database:
|
||||||
return Path(self.path).stat().st_mtime_ns
|
return Path(self.path).stat().st_mtime_ns
|
||||||
|
|
||||||
async def attached_databases(self):
|
async def attached_databases(self):
|
||||||
results = await self.execute(
|
# This used to be:
|
||||||
"select seq, name, file from pragma_database_list() where seq > 0"
|
# select seq, name, file from pragma_database_list() where seq > 0
|
||||||
)
|
# But SQLite prior to 3.16.0 doesn't support pragma functions
|
||||||
return [AttachedDatabase(*row) for row in results.rows]
|
results = await self.execute("PRAGMA database_list;")
|
||||||
|
# {'seq': 0, 'name': 'main', 'file': ''}
|
||||||
|
return [AttachedDatabase(*row) for row in results.rows if row["seq"] > 0]
|
||||||
|
|
||||||
async def table_exists(self, table):
|
async def table_exists(self, table):
|
||||||
results = await self.execute(
|
results = await self.execute(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue