sqlite2postgres: sqlite location as env var

This commit is contained in:
norohind 2021-11-28 17:26:48 +03:00
parent 787a03db4f
commit c84588959b
Signed by: norohind
GPG Key ID: 01C3BECC26FB59E1
2 changed files with 3 additions and 1 deletions

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')

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(