From 42b103343c7126db5f63fe5bc3ce50815c562fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Tue, 26 Dec 2023 18:01:35 +0100 Subject: [PATCH] fix update --- src/fetch_games.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fetch_games.py b/src/fetch_games.py index 8e3b829..e38aaea 100644 --- a/src/fetch_games.py +++ b/src/fetch_games.py @@ -161,7 +161,9 @@ def store_new_games(games: List[GameInfo]): cur, "INSERT INTO games (id, num_players, variant_id, seed, score, num_turns, datetime_started, datetime_finished) " "VALUES %s " - "ON CONFLICT (id) DO NOTHING", + "ON CONFLICT (id) DO UPDATE SET" + "(num_players, variant_id, seed, score, num_turns, datetime_started, datetime_finished)" + "=(excluded.num_players, excluded.variant_id, excluded.seed, excluded.score, excluded.num_turns, excluded.datetime_started, excluded.datetime_finished)", games_vals ) psycopg2.extras.execute_values(