Commit 4fbd4540 authored by Micaël Bergeron's avatar Micaël Bergeron

fix side effects to other ELT

parent 48c6741f
......@@ -43,7 +43,7 @@ class DB:
_engine = None
@classmethod
def setup(self, open_persistent=False, **kwargs):
def setup(self, **kwargs):
self.db_config.update({k: kwargs[k] for k in db_config_keys if k in kwargs})
self._connection = self.connect()
self._engine = create_engine(engine_uri(**self.db_config), creator=self.connect)
......
......@@ -110,6 +110,6 @@ def with_error_exit_code(main):
exit(err.exit_code())
except Exception as e:
logging.error(e)
exit(ExitCode.FAIL)
raise e
return f
......@@ -146,7 +146,7 @@ def upsert_to_db_from_csv(db_conn, csv_file, *,
cursor.copy_expert(sql=copy_query, file=file)
db_conn.commit()
update_columns = [col for col in columns.split(',') if col != primary_key]
update_columns = [col for col in header.split(',') if col != primary_key]
update_query = psycopg2.sql.SQL("INSERT INTO {0}.{1} ({2}) SELECT {2} FROM {3}.{4} ON CONFLICT ({5}) DO UPDATE SET {6}").format(
schema,
table,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment