How to make SQLAlchemy in Tornado to be async ?
I found example for MongoDB on async mongo example but I couldn\'t find anything like
I am using tornado with sqlalchemy in next way:
from tornado_mysql import pools
from sqlalchemy.sql import table, column, select, join
from sqlalchemy.dialects import postgresql, mysql
# from models import M, M2
t = table(...)
t2 = table(...)
xxx_id = 10
j = join(t, t2, t.c.t_id == t2.c.id)
s = select([t]).select_from(j).where(t.c.xxx == xxx_id)
sql_str = s.compile(dialect=mysql.dialect(),compile_kwargs={"literal_binds": True})
pool = pools.Pool(conn_data...)
cur = yield pool.execute(sql_str)
data = cur.fetchone()
In that case we are able to use sqlalchemy models, and sqlalchemy tools for constructig queries.