Tuesday, February 25, 2014

Possible Solution To Slow SQLalchemy + Flask Application

This stackoverflow thread talks about why you want to use scoped_session:
http://stackoverflow.com/questions/6519546/scoped-sessionsession-maker-or-plain-session-maker-in-sqlalchemy

Basically, your web application isn't thread-safe if you're not using scoped_session. It's much better than having you application use a new thread for every instance.

An example of scoped_session in use is available here: https://github.com/mjhea0/flask-boilerplate/blob/master/models.py

No comments:

Post a Comment