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: Ia0e9696dcaafd90f9c6daeb68c72fa2b184823fb
This commit is contained in:
Pierre Riteau 2022-09-14 09:51:02 +02:00
parent c9340b35f6
commit 0ea32a2b51

View File

@ -22,7 +22,11 @@ _FACADE = None
def _create_facade_lazily():
global _FACADE
if _FACADE is None:
_FACADE = session.EngineFacade.from_config(cfg.CONF, sqlite_fk=True)
# FIXME(priteau): Remove autocommit=True (and ideally use of
# LegacyEngineFacade) asap since it's not compatible with SQLAlchemy
# 2.0.
_FACADE = session.EngineFacade.from_config(cfg.CONF, sqlite_fk=True,
autocommit=True)
return _FACADE