Open dikshant opened 10 months ago
Shannon Bradshaw (shannonbradshaw) commented: Dikshant Adhikari, in what context did you come across this?
Dikshant Adhikari (dikshant) commented: Shannon Bradshaw Someone from the community slack flagged it https://cockroachdb.slack.com/archives/C01LKHP0KS6/p1698181388311639
Richard Loveland (rmloveland) commented: Dikshant Adhikari I snagged this and added a prio, plz feel free to change it if you disagree
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 doingasync with conn.transaction():
we should doasync with conn.transaction() as t:
and thent.rollback()
instead ofconn.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.Transactiontime.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