db_transaction()
Commit the block's statements together, or roll all of them back on an error.
A transaction inside another reuses the outer one::
with fw.db_connect("warehouse") as conn, fw.db_transaction(conn):
conn.cursor().execute("UPDATE ...")
Usage
db_transaction(connection: Connection) -> Iterator[Connection]
Arguments
| Name | Type | Description |
|---|---|---|
| connection required | Connection |
An open connection from |
Value
A context manager that yields connection.
Raises
FrameworkError: When the block raises an exception. The transaction is rolled back and the original exception is chained as the cause.