kopia lustrzana https://github.com/simonw/datasette
Verify SQLite DBs with check_connection
rodzic
ec0d68da70
commit
ee718b98b7
|
@ -227,7 +227,7 @@ class Datasette:
|
|||
self.databases.pop(name)
|
||||
|
||||
def scan_dirs(self):
|
||||
# Recurse through self.dirs looking for new SQLite DBs
|
||||
# Recurse through self.dirs looking for new SQLite DBs. Runs in a thread.
|
||||
while True:
|
||||
current_filepaths = {
|
||||
d.path for d in list(self.databases.values()) if d.path is not None
|
||||
|
|
|
@ -603,7 +603,8 @@ def is_valid_sqlite(path):
|
|||
return False
|
||||
# Check we can run `select * from sqlite_master`
|
||||
try:
|
||||
sqlite3.connect(str(path)).execute("select * from sqlite_master")
|
||||
conn = sqlite3.connect(str(path))
|
||||
check_connection(conn)
|
||||
except Exception:
|
||||
return False
|
||||
return True
|
||||
|
|
Ładowanie…
Reference in New Issue