Fix sqlite multi thread error
This commit is contained in:
+2
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user