From 4b15871a30c5c994dde7075aeb577a4bf05aa4d9 Mon Sep 17 00:00:00 2001 From: Becky Smith Date: Mon, 7 Oct 2024 18:15:08 +0100 Subject: [PATCH] Use uri=True for db connections Ensure that sqlite3 always uses URIs for db connections. Different versions of sqlite3 may or may not set the USE_URI compile time option, so make sure it's always used, irrespective. https://www.sqlite.org/compile.html#:~:text=SQLITE_USE_URI --- jobrunner/lib/database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jobrunner/lib/database.py b/jobrunner/lib/database.py index 45f81a5b..e26e20c4 100644 --- a/jobrunner/lib/database.py +++ b/jobrunner/lib/database.py @@ -168,7 +168,7 @@ def get_connection(filename=None): # Looks icky but is documented `threading.local` usage cache = CONNECTION_CACHE.__dict__ if filename not in cache: - conn = sqlite3.connect(filename) + conn = sqlite3.connect(filename, uri=True) # Enable autocommit so changes made outside of a transaction still get # persisted to disk. We can use explicit transactions when we need # atomicity.