From e60b70b4759406283eebf4d6f16c458512b2b63f Mon Sep 17 00:00:00 2001 From: Alexander Bayandin Date: Thu, 15 Jun 2023 13:01:06 +0100 Subject: [PATCH] Fix data ingestion scripts (#4515) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem When I switched `psycopg2.connect` from context manager to a regular function call in https://github.com/neondatabase/neon/pull/4382 I embarrassingly forgot about commit, so it doesn't really put data into DB 😞 ## Summary of changes - Enable autocommit for data ingestion scripts --- scripts/ingest_perf_test_result.py | 4 +++- scripts/ingest_regress_test_result.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/ingest_perf_test_result.py b/scripts/ingest_perf_test_result.py index fc177b590e..35a1e29720 100644 --- a/scripts/ingest_perf_test_result.py +++ b/scripts/ingest_perf_test_result.py @@ -40,7 +40,9 @@ def get_connection_cursor(): @backoff.on_exception(backoff.expo, psycopg2.OperationalError, max_time=150) def connect(connstr): - return psycopg2.connect(connstr, connect_timeout=30) + conn = psycopg2.connect(connstr, connect_timeout=30) + conn.autocommit = True + return conn conn = connect(connstr) try: diff --git a/scripts/ingest_regress_test_result.py b/scripts/ingest_regress_test_result.py index dff8e0cefa..39c1c02941 100644 --- a/scripts/ingest_regress_test_result.py +++ b/scripts/ingest_regress_test_result.py @@ -34,7 +34,9 @@ def get_connection_cursor(): @backoff.on_exception(backoff.expo, psycopg2.OperationalError, max_time=150) def connect(connstr): - return psycopg2.connect(connstr, connect_timeout=30) + conn = psycopg2.connect(connstr, connect_timeout=30) + conn.autocommit = True + return conn conn = connect(connstr) try: