Skip to content
Discussion options

You must be logged in to vote

What you're proposing, if I understand it correctly. seems to me to be a large change to the way that FastAPI operates and there's almost no chance that would be adopted. Many databases do now have async drivers including, from memory so there are likely more than just these, motor, asyncpg, and aiomysql. I'm guessing there are async implementations for interacting with GCP and AWS as well. In general, I'd suggest trying to make your endpoints do as little work as possible and off-load long-running and variable length tasks to BackgroundTasks or some other mechanism that isn't directly within the route.

However, what you can do is run your blocking code in a thread pool. Something like th…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@adamsuskin
Comment options

Answer selected by YuriiMotov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem
2 participants