From dca46364d3f161f60fcfb93af3be4784d3bc5648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Mon, 7 Oct 2024 14:49:29 +0200 Subject: [PATCH] disable SSL connection to PostgreSQL --- src/hanabi/database/database.py | 4 ++-- src/hanabi/live/download_data.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hanabi/database/database.py b/src/hanabi/database/database.py index b3921da..fe8d0dd 100644 --- a/src/hanabi/database/database.py +++ b/src/hanabi/database/database.py @@ -87,8 +87,8 @@ class DBConnectionManager: logger.info("Initialised default config file {}".format(self.config_file)) def connect(self): - conn = psycopg2.connect("dbname='{}' user='{}' password='{}' host='localhost'".format( - self.db_name, self.db_user, self.db_pass) + conn = psycopg2.connect("dbname='{}' user='{}' password='{}' host='localhost' sslmode='disable'".format( + self.db_name, self.db_user, self.db_pass), ) cur = conn.cursor() self.lazy_conn.set_conn(conn) diff --git a/src/hanabi/live/download_data.py b/src/hanabi/live/download_data.py index ebe0a24..9a7ff12 100644 --- a/src/hanabi/live/download_data.py +++ b/src/hanabi/live/download_data.py @@ -250,12 +250,12 @@ def _process_game_row(game: Dict, var_id, export_all_games: bool = False): "ON CONFLICT (id) DO NOTHING", (game_id, seed, num_players, score, var_id) ) + database.cur.execute("RELEASE seed_insert") except psycopg2.errors.ForeignKeyViolation: # Sometimes, seed is not present in the database yet, then we will have to query the full game details # (including the seed) to export it accordingly database.cur.execute("ROLLBACK TO seed_insert") detailed_export_game(game_id, score=score, var_id=var_id) - database.cur.execute("RELEASE seed_insert") # Insert participants into database ids = ensure_users_in_db_and_get_ids(users)