E3FC Cursor cannot be used with externally-managed transaction · Issue #1311 · MagicStack/asyncpg · GitHub
[go: up one dir, main page]

Skip to content

Cursor cannot be used with externally-managed transaction #1311

@coleifer

Description

@coleifer

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().

asyncpg/asyncpg/cursor.py

Lines 114 to 116 in db8ecc2

if not self._connection._top_xact:
raise exceptions.NoActiveSQLTransactionError(
'cursor cannot be created outside of a transaction')

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()?

if self._protocol.is_in_transaction() or self._top_xact is not None:

I'd like to be able to use server-side cursors with Peewee's library-managed transactions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0