From 27206b2c047dbeb9cb61ae252eeb986170112bf1 Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Fri, 9 Sep 2022 16:22:49 +0200 Subject: [PATCH] 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 Change-Id: Ic7c5703c1d1009f6c402766aeb20fa9869495470 --- blazar/db/sqlalchemy/facade_wrapper.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/blazar/db/sqlalchemy/facade_wrapper.py b/blazar/db/sqlalchemy/facade_wrapper.py index 4887f6ed..a35407b8 100644 --- a/blazar/db/sqlalchemy/facade_wrapper.py +++ b/blazar/db/sqlalchemy/facade_wrapper.py @@ -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