Skip to content

Commit

Permalink
Postgres copy explicates columns and column order
Browse files Browse the repository at this point in the history
  • Loading branch information
austinweisgrau committed Sep 20, 2024
1 parent 1163cc0 commit 7795783
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion parsons/databases/postgres/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down

0 comments on commit 7795783

Please sign in to comment.