Transaction context manager. You can run your code inside ``async with in_transaction():`` statement to run it into one transaction. If error occurs transaction will rollback. :param connection_name: name of connection to run with, optional if you have only
(connection_name: str | None = None)
| 31 | |
| 32 | |
| 33 | def in_transaction(connection_name: str | None = None) -> TransactionContext: |
| 34 | """ |
| 35 | Transaction context manager. |
| 36 | |
| 37 | You can run your code inside ``async with in_transaction():`` statement to run it |
| 38 | into one transaction. If error occurs transaction will rollback. |
| 39 | |
| 40 | :param connection_name: name of connection to run with, optional if you have only |
| 41 | one db connection |
| 42 | """ |
| 43 | connection = _get_connection(connection_name) |
| 44 | return connection._in_transaction() |
| 45 | |
| 46 | |
| 47 | def atomic(connection_name: str | None = None) -> Callable[[F], F]: |
searching dependent graphs…