surechembl-data-client
surechembl-data-client copied to clipboard
Transaction needs to be reset after duplicate
While using this script to fill our Postgresql database, I discovered that whenever duplicates are detected in data_loader.py
(line 336), the transaction is not always reset.
So this exception is raised for the next INSERT INTO command:
sqlalchemy.exc.InternalError: (InFailedSqlTransaction) current transaction is aborted, commands ignored until end of transaction block
To solve this I added the following code on line 341:
# Reset transaction
transaction.commit()
transaction = sql_alc_conn.begin()