Fix compatibility with oslo.db 12.1.0

oslo.db 12.1.0 has changed the default value for the 'autocommit'
parameter of 'LegacyEngineFacade' from 'True' to 'False'. This is a
necessary step to ensure compatibility with SQLAlchemy 2.0. However, we
are currently relying on the autocommit behavior and need changes to
explicitly manage sessions. Until that happens, we need to override the
default.

Co-Authored-By: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Ic7c5703c1d1009f6c402766aeb20fa9869495470
This commit is contained in:
Pierre Riteau 2022-09-09 16:22:49 +02:00
parent 22e99c1827
commit 27206b2c04

View File

@ -38,6 +38,10 @@ def _clear_engine():
def _get_facade():
global _engine_facade
if not _engine_facade:
_engine_facade = db_session.EngineFacade.from_config(CONF)
# FIXME(priteau): Remove autocommit=True (and ideally use of
# LegacyEngineFacade) asap since it's not compatible with SQLAlchemy
# 2.0.
_engine_facade = db_session.EngineFacade.from_config(CONF,
autocommit=True)
return _engine_facade