In no particular order
- Django doesn’t have an async ORM? (https://docs.djangoproject.com/en/5.0/topics/async/)
- Django Rest Framework has no async support? https://github.com/encode/django-rest-framework/issues/7260
- SQLModel’s section on async support basically says “docs coming soon”? Yet this is designed to be used with FastAPI? Why would the docs not start with async/await? https://sqlmodel.tiangolo.com/advanced/
- SqlAlchemy/asyncpg => you can’t use it if you’re using PgBouncer (necessary most of the time with Postgres) in transaction mode? What?? https://github.com/MagicStack/asyncpg/issues/1058
- Ubiquitous “requests” library used in most docs examples, no async support https://github.com/psf/requests
- Top package for GitHub REST API, no async support https://github.com/PyGithub/PyGithub
- …on and on…
What’s the point of my nice FastAPI server if nothing internally can use async/await? How is everyone else doing this?
/rant
I was interested in the situation with the Django ORM however. The page you linked to seems somewhat contradictory. In the section on "Queries and the ORM" it seems that there are asynchronous versions for most queries that actually cause an SQL query:
https://docs.djangoproject.com/en/5.0/topics/async/#queries-...
These should also be fine to be executed in an async context, right? But then later in the section on async safety it somewhat seems like the ORM is totally prevented from being executed in an asynchronous manner:
https://docs.djangoproject.com/en/5.0/topics/async/#async-sa...
The linked section on orm queries however makes it seem like it should be possible to use the Django ORM asynchronously if you only use the async methods (aget, aupdate, async for, ...) and watch out for some gotchas:
https://docs.djangoproject.com/en/5.0/topics/db/queries/#asy...
Having one thread per worker sounds better. Or the actor model
Sure async/await is "easy" but also turns every code into a mess