How a driver runs its transactions.
acquire_connection(restore): the connection of an outermost transaction; it runs masked, so wrap the wait inrestore. Its scope closes with the transaction.begin(conn, statement): start one (statementis theBeginTransactionprovided, if any)savepoint/rollback_savepoint/release_savepoint: nested levels (release_savepointis optional)commit,rollback;on_commit_failurecleans up the connection whenCOMMITfails
Attributes#
| Attribute | Type | Description |
|---|---|---|
transaction_service | type[TransactionConnection] | |
span_attributes | tuple[tuple[str, object], ...] | |
acquire_connection | Callable[[Restore], Effect[Connection, SqlError, Scope]] | |
begin | Callable[[Connection, str | None], Effect[None, SqlError]] | |
savepoint | LevelControl | |
commit | Control | |
rollback | Control | |
rollback_savepoint | LevelControl | |
release_savepoint | LevelControl | None = None | |
on_commit_failure | Control | None = None |
Functions#
__init__#
__init__(*, transaction_service, span_attributes, acquire_connection, begin, savepoint, commit, rollback, rollback_savepoint, release_savepoint=None, on_commit_failure=None) -> None| Parameter | Type | Description |
|---|---|---|
transaction_service | type[TransactionConnection] | |
span_attributes | tuple[tuple[str, object], ...] | |
acquire_connection | Callable[[Restore], Effect[Connection, SqlError, Scope]] | |
begin | Callable[[Connection, str | None], Effect[None, SqlError]] | |
savepoint | LevelControl | |
commit | Control | |
rollback | Control | |
rollback_savepoint | LevelControl | |
release_savepoint | LevelControl | None = None | |
on_commit_failure | Control | None = None |