2 ms·
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. T
by gonational 7y ago
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 https://github.com/MagicStack/asyncpg
2. https://magicstack.github.io/asyncpg/current/ https://magicstack.github.io/asyncpg/current/