Fix sqlite multi thread error

master
Abdussamet Kocak 6 years ago
parent 8dbcb420b1
commit c605b5fd56

@ -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

Loading…
Cancel
Save