kennethreitz / records

SQL for Humans™
https://pypi.python.org/pypi/records/
ISC License
7.14k stars 570 forks source link

Within transaction, the error disappeared #195

Open nexttonever opened 4 years ago

nexttonever commented 4 years ago

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()
kennethreitz commented 3 months ago

Ask yourself this —