sqlite2postgres: sqlite location as env var

This commit is contained in:
norohind committed 2021-11-28 17:26:48 +03:00
1 parent 787a03db4f
commit c84588959b
2 files changed
+3 -1

No files matched your search

+2
View File
@@ -17,3 +17,5 @@ sqlite_db_path = os.getenv('SQLITE_DB_PATH', 'squads_stat.sqlite3')
log_level = os.getenv('LOG_LEVEL', 'DEBUG').upper()
time_between_requests = os.getenv("TIME_BETWEEN_REQUESTS")
sqlite2postgres_sqlite_location = os.getenv('SQLITE2POSTGRES_SQLITE_LOCATION')
+1 -1
View File
@@ -15,7 +15,7 @@ values
(%(action_id)s, %(leaderboard_type)s, %(platform)s, %(squadron_id)s, %(score)s,
%(percentile)s, %(rank)s, %(name)s, %(tag)s, %(timestamp)s);"""
sqlite_conn: sqlite3.Connection = sqlite3.connect('squads_stat.sqlite3', check_same_thread=False)
sqlite_conn: sqlite3.Connection = sqlite3.connect(config.sqlite2postgres_sqlite_location, check_same_thread=False)
sqlite_conn.row_factory = lambda c, r: dict(zip([col[0] for col in c.description], r))
pg_conn: psycopg2.extensions.connection = psycopg2.connect(