Remove use of autocommit
Change-Id: I6e973935edf5e754ba054e724b6963b6d5fd795a
This commit is contained in:
@@ -47,9 +47,7 @@ _FACADE = None
|
|||||||
def _create_facade_lazily():
|
def _create_facade_lazily():
|
||||||
global _FACADE
|
global _FACADE
|
||||||
if _FACADE is None:
|
if _FACADE is None:
|
||||||
# FIXME(karolinku): autocommit=True it's not compatible with
|
_FACADE = db_session.EngineFacade.from_config(CONF)
|
||||||
# SQLAlchemy 2.0, and will be removed in future
|
|
||||||
_FACADE = db_session.EngineFacade.from_config(CONF, autocommit=True)
|
|
||||||
if profiler_sqlalchemy:
|
if profiler_sqlalchemy:
|
||||||
if CONF.profiler.enabled and CONF.profiler.trace_sqlalchemy:
|
if CONF.profiler.enabled and CONF.profiler.trace_sqlalchemy:
|
||||||
profiler_sqlalchemy.add_tracing(sa, _FACADE.get_engine(), "db")
|
profiler_sqlalchemy.add_tracing(sa, _FACADE.get_engine(), "db")
|
||||||
|
|||||||
@@ -93,7 +93,8 @@ class MagnumBase(models.TimestampMixin,
|
|||||||
if session is None:
|
if session is None:
|
||||||
session = db_api.get_session()
|
session = db_api.get_session()
|
||||||
|
|
||||||
super(MagnumBase, self).save(session)
|
with session.begin():
|
||||||
|
super(MagnumBase, self).save(session)
|
||||||
|
|
||||||
|
|
||||||
Base = declarative_base(cls=MagnumBase)
|
Base = declarative_base(cls=MagnumBase)
|
||||||
|
|||||||
Reference in New Issue
Block a user