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