Within transaction, the error disappeared
Author: nexttoneverCreated Jul 17, 2020Updated Feb 9, 2026
code like this: db = ... with db.transaction() as tx: tx.query(...) # raise an sql error
but the error raised by tx.query disappears. I found the code: def transaction(self): """A context manager for executing a transaction on this Database."""
conn = self.get_connection()
tx = conn.transaction()
try:
yield conn
tx.commit()
except:
tx.rollback()
raise # This may be the solution
finally:
conn.close()Source: kennethreitz/records