surechembl-data-client icon indicating copy to clipboard operation
surechembl-data-client copied to clipboard

Transaction needs to be reset after duplicate

Open mthaak opened this issue 4 years ago • 0 comments

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()

mthaak avatar May 01 '20 11:05 mthaak