I'm relatively new to application development but here goes nothing.
I've been working on a project that employs the use of a Tornado server and SQLAlchemy's ORM for database management/access (using postgres in the back end).
At the outset of the project I hadn't considered the possibility that using SQLAlchemy would prevent me from taking advantage of Tornado's async features (since SQLAlchemy's database calls apparently 'block' the thread).
Do you have any suggestions as to how to implement an async-compatible setup with Tornado+SQLA+postgres?
Take a look at aiopg - https://github.com/aio-libs/aiopg
It is a Python 3.4 asyncio adapter for postgres that includes sqlalchemy support. I haven't tried it myself yet, but found it while looking for async libraries for postgres and tornado. I am using Momoko, but it only supplies the raw psycopg2 layer.
Remember that the latest version of Tornado supports asyncio, so asyncio libraries will now work with Tornado.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With