⚡ Sangsakala Proxy 🏠 Home
Skip to content

Test asynchronous command processing #41

Open

Description

@Cito

In version 5.2 we integrated support for asynchronous command processing which has been contributed on the mailing list by Patrick TJ McPhee a while ago (see #19).

However, this feature is still experimental and only rudimentary tested. We need much more testing.

  • nowait parameter
  • method poll(), set_non_blocking(), is_non_blocking().
  • method send_query() and all ways of getting results afterwards
    (iterators, scalars, one, single, direct access etc.)

Activity

  1. added this to the 5.2.1 milestone on Jun 19, 2020
  2. modified the milestones: 5.2.1, 5.3 on Sep 25, 2020
  3. modified the milestones: 5.3, 6.1 on Aug 27, 2023
  4. modified the milestones: 6.1, 6.2 on Dec 5, 2024
  5. justinpryzby commented on Jan 5, 2026

    @justinpryzby
    Collaborator

    One thing I've noticed is that the async queries seem to be incompatible with the query iterators and indexing.

    Compare

    $ python3 -c "import pg; db=pg.DB(); ret=db.send_query('SELECT 1; SELECT 2;'); print(ret[0]); print(ret[0]); print(ret[0]);"i in ret]); print([i for i in ret])
    (1,)
    (2,)
    None
    
    $ python3 -c "import pg; db=pg.DB(); ret=db.query('SELECT 1; SELECT 2;'); print(ret[0]); print(ret[0]); print(ret[0]);"ret]); print([i for i in ret])
    (2,)
    (2,)
    (2,)
    

    That's an unfortunate limitation, and inconsistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions