I think you may have it backwards. Django's ORM isn't async yet [1], whereas FastAPI doesn't actually have an "included" ORM. However, the docs give an example of an async ORM [2], and SQLAlchemy also has async support [3].
---
[1] https://docs.djangoproject.com/en/4.0/topics/async/: We’re still working on async support for the ORM
[2] https://fastapi.tiangolo.com/advanced/async-sql-databases/
[3] https://docs.sqlalchemy.org/en/14/orm/extensions/asyncio.htm...
Full support for Django and particularly it’s ORM (hard to do with FastAPI as the Django ORM is not yet async and can’t be used with FastAPI)
Will edit to make clear.
Plans exist to make the Django Queryset async, so it’ll be exciting when that day comes!
https://github.com/django/django/pull/14843
So far they are only going down the the queryset level, it then uses a thread pool for the db connector, next job would be to support async db connections.
1. https://github.com/collerek/ormar 2. https://github.com/tophat/ormar-postgres-extensions/
https://github.com/tiangolo/sqlmodel
I have not yet used it, but I think that’s the best approach now
SQLModel 100 issues, 54 open PRs
FastAPI 903 issues, 448(!!) open PRs
I recently had to choose between Flask and FastAPI for a fresh project and went with Flask in the end, partly due to long term maintenance concerns with FastAPI.
https://django-ninja.rest-framework.com/motivation/
It sounds super interesting, it fits the middle ground between Django Rest Framework and FastAPI taking the best of both. Full support for Django and particularly it’s ORM (hard to do with FastAPI as the Django ORM is not yet async and can’t be used with FastAPI)
I like that it supports both sync and async as I’m personally not convinced about the use of async Python everywhere. I could see this being brilliant for an api where the majority is simple sync code but with a few endpoint with long running responses or where you need multiple concurrent requests to DBS or other APIs.
(Edited for clarity, thanks vladvasiliu)