I have a script that imports data from old database. Somewhere along the way I run into unique constraint violation. I want to amend the query and execute it again, but it says, "psycopg2.InternalError: current transaction is aborted, commands ignored until end of transaction block":
try:
pcur.execute(sql, values)
except psycopg2.IntegrityError:
value = ...
pcur.execute(sql, values)
How do I do that without switching to autocommit mode?