emmett-framework / emmett

The web framework for inventors
Other
1.03k stars 70 forks source link

Use async drivers for database operations #456

Open pramos84 opened 1 year ago

pramos84 commented 1 year ago

Considering that Emmett is an async framework, making use of the new async/await features of Python and Uvicorn, it would be desirable to prioritize the use of async drivers in database access. I believe it doesn't take much effort to replace pymysql with aiomysql, for example, or pyodbc with aioodbc. I don't know how mature are these modules, I admit, but they tend to increase the performance of database operations, mostly at intensive load applications.

By the way, there's no other framework with the elegance and objectivity of Emmett. It has at same time only and all features required by vast majority of modern web applications, dispensing with the need of third-party modules for common operations, like database access, session management or templating, yet still maintaining lightweight and simplicity in code structure. Congratulations!

Thanks for all work.

gi0baro commented 1 year ago

Thank you for the nice words @pramos84

Actually the hard thing of making Emmett's ORM async is not regarding drivers, but on Model interfaces. This is quite hard, and tracked on https://github.com/emmett-framework/firestorm/issues/3, but first we need to complete #309 (this is why there's an empty repo for the ORM right now).

Also mind that async won't make your code more performant, it will just increase the concurrency.