sqlalchemy 是非异步库

2019-06-03  本文已影响0人  来一碗花甲粉

The "scope" in scoped_session is a thread, which makes it inappropriate for use in an asynchronous framework like Tornado. It's been a long time since I've used sqlalchemy sessions, but I think what you want to do is put a sessionmaker on the Application, and make a session from it in RequestHandler.prepare (not initialize - they're almost equivalent, but if something goes wrong you generally get nicer error pages from prepare).

上一篇 下一篇

猜你喜欢

热点阅读