ORM . ORM , , . , , . , , - , ( , SQLAlchemy raw SQL ). , , . PeeWee, SQLAlchemy , ( , , ).
, ThreadPoolExecutor Peewee . , , . , , , ORM :
from concurrent.futures import ThreadPoolExecutor
executor = ThreadPoolExecutor(max_workers=10)
def queryByName(name):
query = executor.submit(db_model.findOne, name=name)
query.add_done_callback(processResult)
def processResult(query):
orm_obj = query.results()
yeild from await , . , . Tornado, , db . , - .
, MagicStack (, asyncio), asyncpg, ! , : (