Opened 4 months ago

Last modified 7 days ago

#35629 assigned New feature

Implement async cursors

Reported by: Flavio Curella Owned by: Flavio Curella
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords: async, psycopg, PostgreSQL
Cc: Dingning, Jon Janzen, Andrew Godwin, Paolo Melchiorre, Evstifeev Roman Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

With Psycopg3 offering async connections and async cursors, we can start implementing at least part of DEP0009 on the ORM

The first step would be just a low-level API, so that we can make the async cursor available to our users:

from django.db import new_connection

async with new_connection(using="default") as conn:
    async with conn.acursor() as c:
        await c.execute(...)

Note: In order to have a simpler and easier review, I've considered transaction.atomic out of scope for this ticket.

Change History (6)

comment:1 by Sarah Boyce, 4 months ago

Cc: Dingning Jon Janzen Andrew Godwin added
Triage Stage: UnreviewedAccepted

I see this was suggested as part 1 of a plan here: https://forum.djangoproject.com/t/dep0009-orm-implementation-plan/33194 with some positive feedback from Andrew Godwin
Tentatively accepted

comment:2 by Sarah Boyce, 4 months ago

Owner: set to Flavio Curella
Status: newassigned

comment:4 by Paolo Melchiorre, 3 months ago

Cc: Paolo Melchiorre added
Keywords: async psycopg PostgreSQL added

comment:5 by Evstifeev Roman, 3 months ago

Cc: Evstifeev Roman added

comment:6 by Sarah Boyce, 7 days ago

Patch needs improvement: set
Note: See TracTickets for help on using tickets.
Back to Top