feat: autocommit session

main
Ricard Illa 2023-06-25 12:22:06 +02:00
parent 915f3c2a4c
commit 4a3d43bcc5
No known key found for this signature in database
GPG Key ID: F69A672B72E54902
1 changed files with 2 additions and 1 deletions

View File

@ -47,7 +47,8 @@ class WriteToPostgreSQL(beam.DoFn):
self.table_key = table_key self.table_key = table_key
def setup(self): def setup(self):
self.connection = psycopg2.connect(**self.connection_details, autocommit=True) self.connection = psycopg2.connect(**self.connection_details)
self.connection.autocommit = True
def execute_insert(self, row, cursor): def execute_insert(self, row, cursor):
colnames = ",".join(row.keys()) colnames = ",".join(row.keys())