Open
Description
Dikshant Adhikari (dikshant) commented:
https://github.com/cockroachdb/example-app-python-asyncpg/blob/main/example.py#L86
uses conn.rollback()
which is not a thing. We are doing async with conn.transaction():
we should do async with conn.transaction() as t:
and then t.rollback()
instead of conn.rollback()
because rollbacks are defined at the transaction level and not the connection level
https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.transaction.Transaction
time.sleep should also be updated to use await async.io sleep as a best practie
https://github.com/cockroachdb/example-app-python-asyncpg/blob/main/example.py#L90
Jira Issue: DOC-9106