Quantcast
Channel: Can not "COPY FROM" with Postgres & Python - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by Craig Ringer for Can not "COPY FROM" with Postgres & Python

$
0
0

As alluded to by @a_horse_with_no_name, you're closing the PostgreSQL database connection, but you're not committing the transaction first.

psycopg2 opens a transaction for you if there isn't one already open. It expects you to commit this transaction when you've finished your work.

Unless you explicitly commit a transaction, closing the connection will rollback any work that's been done.

Try con.commit() after the last copy command.


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>