From c605b5fd56393bcaea7d63197c99a3cb0321fa39 Mon Sep 17 00:00:00 2001 From: Abdussamet Kocak Date: Mon, 20 Jan 2020 21:26:41 +0300 Subject: [PATCH] Fix sqlite multi thread error --- core/diyanetdb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/diyanetdb.py b/core/diyanetdb.py index e56ad1d..04939ef 100644 --- a/core/diyanetdb.py +++ b/core/diyanetdb.py @@ -25,7 +25,7 @@ def get_connection() -> sqlite3.Connection: d[col[0]] = row[idx] return d - conn = sqlite3.connect(config.DB_PATH) + conn = sqlite3.connect(config.DB_PATH, check_same_thread=False) conn.row_factory = dict_factory yield conn conn.close() @@ -58,7 +58,7 @@ def save_locations(conn: sqlite3.Connection, locations: List[dict]): def find_locations(conn: sqlite3.Connection, *, country: str, - city: str = '') -> List[Location]: + city: str = None) -> List[Location]: sql = ''' SELECT DISTINCT id, country, city, region FROM locations