From 4a3d43bcc5f4e0017f795977e10b26c06f7548fb Mon Sep 17 00:00:00 2001 From: Ricard Illa Date: Sun, 25 Jun 2023 12:22:06 +0200 Subject: [PATCH] feat: autocommit session --- etl/helpers/data_io.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/etl/helpers/data_io.py b/etl/helpers/data_io.py index 1ce62c9..e2dbfe9 100644 --- a/etl/helpers/data_io.py +++ b/etl/helpers/data_io.py @@ -47,7 +47,8 @@ class WriteToPostgreSQL(beam.DoFn): self.table_key = table_key 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): colnames = ",".join(row.keys())