From a22c06a7de7c86ae8401cfa6edc0ecd9bf38dc65 Mon Sep 17 00:00:00 2001 From: Austin Weisgrau Date: Mon, 16 Sep 2024 15:31:28 -0700 Subject: [PATCH] Postgres copy explicates columns and column order --- parsons/databases/postgres/postgres.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parsons/databases/postgres/postgres.py b/parsons/databases/postgres/postgres.py index fc1c8c1642..6b90adfe11 100644 --- a/parsons/databases/postgres/postgres.py +++ b/parsons/databases/postgres/postgres.py @@ -87,7 +87,7 @@ def copy( self.query_with_connection(sql, connection, commit=False) logger.info(f"{table_name} created.") - sql = f"COPY {table_name} FROM STDIN CSV HEADER;" + sql = f"COPY {table_name} ({','.join(tbl.columns)}) FROM STDIN CSV HEADER;" with self.cursor(connection) as cursor: cursor.copy_expert(sql, open(tbl.to_csv(), "r"))