Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Cursor cannot be used with externally-managed transaction

Open
#1,311 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
postgresql, python
Domain
database

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.

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.

Dominant language
Python
Stars
8.1k
Forks
469
Avg merge
2d 20h
Merged PRs (30d)
9

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MagicStack/asyncpg

All issues in MagicStack/asyncpg

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.