summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwu.chunyang <wuchunyang@yovole.com>2022-09-14 16:29:07 +0800
committerwu.chunyang <wuchunyang@yovole.com>2022-09-14 17:50:24 +0800
commitaf1db229b93e8ae408682f84fa72d38c6e827bec (patch)
treedf4f8028d2cd36051dedac5adfb387277b916aad
parent6e4dd51c02f042efcfd6fb89575f100d44ac0a60 (diff)
downloadtrove-af1db229b93e8ae408682f84fa72d38c6e827bec.tar.gz
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
-rw-r--r--trove/db/sqlalchemy/session.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/trove/db/sqlalchemy/session.py b/trove/db/sqlalchemy/session.py
index 39a0f218..1d2a1e08 100644
--- a/trove/db/sqlalchemy/session.py
+++ b/trove/db/sqlalchemy/session.py
@@ -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