Scoping the session per thread (request).

Fixes issue #94
http://docs.sqlalchemy.org/en/rel_0_7/orm/session.html#sqlalchemy.orm.scoped_session
This commit is contained in:
Chris Alfonso committed 2012-05-01 11:05:48 -04:00
1 parent f7c1b3311d
commit dc3c5bdf3d
2 files changed
+2 -4

No files matched your search

-2
View File
@@ -39,8 +39,6 @@ db_opts = [
help='The backend to use for db'),
]
#conf = config.HeatEngineConfigOpts()
#conf.db_backend = 'heat.db.sqlalchemy.api'
IMPL = heat.utils.LazyPluggable('db_backend',
sqlalchemy='heat.db.sqlalchemy.api')
+2 -2
View File
@@ -106,9 +106,9 @@ def get_engine():
def get_maker(engine, autocommit=True, expire_on_commit=False):
"""Return a SQLAlchemy sessionmaker using the given engine."""
return sqlalchemy.orm.sessionmaker(bind=engine,
return sqlalchemy.orm.scoped_session(sqlalchemy.orm.sessionmaker(bind=engine,
autocommit=autocommit,
expire_on_commit=expire_on_commit)
expire_on_commit=expire_on_commit))
def _get_sql_connection():