Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Commit 0af2db8

Browse files
Updated transactions documentation for low-level usage. (#209)
Using the lower-level API for Transactions requires that `await transaction.start()` is called so `transaction._connection` exists. Also, low-level usage of transactions did not include the use of `await` for `transaction.rollback()` and `.commit()`. Co-authored-by: Vadim Markovtsev <vadim@athenian.co>
1 parent 074c051 commit 0af2db8

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

docs/connections_and_transactions.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,12 @@ For a lower-level transaction API:
7171
```python
7272
transaction = await database.transaction()
7373
try:
74+
await transaction.start()
7475
...
7576
except:
76-
transaction.rollback()
77+
await transaction.rollback()
7778
else:
78-
transaction.commit()
79+
await transaction.commit()
7980
```
8081

8182
You can also use `.transaction()` as a function decorator on any async function:

0 commit comments

Comments
 (0)