mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Filter out temp database from attached_databases()
Refs https://github.com/simonw/datasette/issues/2557#issuecomment-3470510837
This commit is contained in:
parent
ce4b0794b2
commit
5247856bd4
1 changed files with 6 additions and 1 deletions
|
|
@ -410,7 +410,12 @@ class Database:
|
||||||
# But SQLite prior to 3.16.0 doesn't support pragma functions
|
# But SQLite prior to 3.16.0 doesn't support pragma functions
|
||||||
results = await self.execute("PRAGMA database_list;")
|
results = await self.execute("PRAGMA database_list;")
|
||||||
# {'seq': 0, 'name': 'main', 'file': ''}
|
# {'seq': 0, 'name': 'main', 'file': ''}
|
||||||
return [AttachedDatabase(*row) for row in results.rows if row["seq"] > 0]
|
return [
|
||||||
|
AttachedDatabase(*row)
|
||||||
|
for row in results.rows
|
||||||
|
# Filter out the SQLite internal "temp" database, refs #2557
|
||||||
|
if row["seq"] > 0 and row["name"] != "temp"
|
||||||
|
]
|
||||||
|
|
||||||
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