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

Django ORM is not async so using it with FastAPI would block the event loop. I guess you could wrap the calls in sync_to_async from asgiref but it wouldn't be pretty.

Another option is using something like Tom Christie's orm project (https://github.com/encode/orm), which is a wrapper on top of sqlachemy with a django like interface.




FastAPI runs blocking IO/sync functions in a separate thread pool to work around this issue.


Thanks for the suggestion - very interesting.




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

Search: