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.

Change-Id: I93ab8e0cce22a71efc08f73bde804d99a63b4a8d
This commit is contained in:
wu.chunyang 2022-09-14 16:29:07 +08:00
parent 6e4dd51c02
commit af1db229b9
1 changed files with 4 additions and 0 deletions

View File

@ -94,6 +94,10 @@ def _create_facade(options):
# use enginefacade.from_config() instead
database_opts = dict(CONF.database)
database_opts.pop('query_log')
# FIXME(wuchunyang): we need to remove reliance on autocommit
# semantics ASAP. since it's not compatible with
# SQLAlchemy 2.0
database_opts['autocommit'] = True
_FACADE = session.EngineFacade(
options['database']['connection'],
**database_opts