http://techspot.zzzeek.org/2015/02/15/asynchronous-python-and-databases/
The asynchronous programming topic is difficult to cover. These days, it's not just about one thing, and I'm mostly an outsider to it. However, because I deal a lot with relational databases and the Python stack's interaction with them, I have to field a lot of questions and issues regarding #asynchronous_IO and #database programming, both specific to #SQLAlchemy as well as towards #Openstack.
#asyncio
http://aiomysql.readthedocs.io/en/latest/sa.html
aiomysql.sa — support for SQLAlchemy functional SQL layer
sqlalchemy support ported from #aiopg, so #api should be very familiar for aiopg user.
While core API provides a core support for access to #MySQL#database, manipulations with raw SQL strings too annoying.
Fortunately we can use excellent SQLAlchemy Core as SQL query builder.
So you can execute SQL #query built by tbl.insert().values(val='abc') or tbl.select() expressions.
#sqlalchemy has rich and very powerful set of SQL construction functions, please read tutorial for full list of available operations.
Also we provide SQL transactions support. Please take a look on SAConnection.begin() method and family.