Hacker News new | past | comments | ask | show | jobs | submit login

Correct - the Django ORM is not (yet) async.

The asyncpg library[1][2] could be used for direct, asynchronous database access, from within a Django 3.x app.

The asyncpg library is a low-level async Postgres adaptor, similar to psycopg2, except that it provides much better abstractions and automatic encoding / decoding (vs just piping bytes back and forth like psycopg2), not to mention it is much faster than anything else out there. IOW, asyncpg would serve as a much better foundation for a future ORM. My best guess is that, in the future, Django's ORM will be refactored to optionally support async and will supply an adaptor for asyncpg.

1. https://github.com/MagicStack/asyncpg

2. https://magicstack.github.io/asyncpg/current/




Asyncpg is amazing, I’m writing a thin dataclass-style semi-orm-layer ontop is asyncpg. Still very early but I’m considering cleaning it up and extracting it to a stand-alone library if I see any demand for it.


aiopg is also great and has full SQLAlchemy support




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: