dimagi/commcare-hq — pull request #3796 by snopoke (2014-07-04 14:45:53+00:00)
Title: scoped session factory

Rather than creating a new session / connection in every place that it is required use a scoped session factory (scoped to the thread) to manage connections as described here: http://docs.sqlalchemy.org/en/rel_0_9/orm/session.html?highlight=session#using-thread-local-scope-with-web-applications