diff --git a/data_diff/databases/postgresql.py b/data_diff/databases/postgresql.py index 2b044b36..996d7a4a 100644 --- a/data_diff/databases/postgresql.py +++ b/data_diff/databases/postgresql.py @@ -147,10 +147,10 @@ def create_connection(self): pg = import_postgresql() try: - c = pg.connect(**self._args) + self._conn = pg.connect(**self._args) if SESSION_TIME_ZONE: - c.cursor().execute(f"SET TIME ZONE '{SESSION_TIME_ZONE}'") - return c + self._conn.cursor().execute(f"SET TIME ZONE '{SESSION_TIME_ZONE}'") + return self._conn except pg.OperationalError as e: raise ConnectError(*e.args) from e