The Django ORM can't just be used with asyncio directly, sadly. The database_sync_to_async function you found there will help you call the ORM from asynchronous code, but it still runs the ORM in a synchronous thread (see https://channels.readthedocs.io/en/latest/topics/databases.html)
The project to make the ORM truly async is a tough one and yet to be started. Andrew On Tue, Sep 18, 2018 at 5:55 AM luke lukes <lordluk...@gmail.com> wrote: > I'm looking for something that can allow the usage of the Django ORM with > asyncio (with PostgreSQL). > > As of now I found only aiopg <https://github.com/aio-libs/aiopg> in the > *asyncio > ecosystem* <https://github.com/aio-libs>, which allows to run raw SQL or > to use SQLAlchemy only. > > > I then found something in the django channels docs > <https://channels.readthedocs.io/en/latest/topics/databases.html#database-sync-to-async> > . > > > is this: > > https://github.com/django/channels/blob/master/channels/db.py > > > the missing piece that I was looking for? > > > Thanks > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/2af17ca1-6d48-45b0-9406-37e046934567%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/2af17ca1-6d48-45b0-9406-37e046934567%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFwN1uq7sZPzw1M6DJAqrFs7pttFz6PWemobgHogCsN6PR-jpQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.