Fix data ingestion scripts (#4515)

## 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
This commit is contained in:
Alexander Bayandin
2023-06-15 13:01:06 +01:00
committed by GitHub
parent 2252c5c282
commit e60b70b475
2 changed files with 6 additions and 2 deletions

View File

@@ -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:

View File

@@ -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: