MagicStack / MagicStack/asyncpg
Cursor cannot be used with externally-managed transaction
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.1k
- Forks
- 468
- PR merge metrics
- No merged PRs in 30d
Description
Asyncpg 0.31.0, installed from pip and running against a local pg database. This is not a deployment issue, but rather an issue w/the check performed by `Cursor._check_ready()`.
https://github.com/MagicStack/asyncpg/blob/db8ecc2a38e16fb0c090aef6f5506547c2831c24/asyncpg/cursor.py#L114-L116
Working on implementing streaming results for Peewee and I'm running into an issue w/the Cursor `_check_ready()`. Currently it requires an asyncpg-managed transaction in order to proceed. Is there a reason it doesn't do a similar check to the one here, where it queries `is_in_transaction()`?
https://github.com/MagicStack/asyncpg/blob/db8ecc2a38e16fb0c090aef6f5506547c2831c24/asyncpg/connection.py#L1532
I'd like to be able to use server-side cursors with Peewee's library-managed transactions.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with asyncpg/cursor.py at Cursor._check_ready(), then compare its transaction check with connection.py at is_in_transaction(). Determine whether readiness can recognize an externally managed transaction without breaking asyncpg-managed cursors; done means server-side cursors work with Peewee's library-managed transactions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100