summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Finucane <stephenfin@redhat.com>2022-09-05 17:19:48 +0100
committerStephen Finucane <stephenfin@redhat.com>2022-09-05 17:20:37 +0100
commit7460ae30bf92b5bdf68137bc5de9f7891a33b89b (patch)
treeddc2453abf439614ebc5754c5fc8a97766405c6f
parent729e3bf659ccd484418245729e0d7bd4f6b6d1b8 (diff)
downloaddesignate-7460ae30bf92b5bdf68137bc5de9f7891a33b89b.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. Signed-off-by: Stephen Finucane <stephenfin@redhat.com> Change-Id: I2e02b00309c8a0289954b7cd6838bd9320cec3e0
-rw-r--r--designate/sqlalchemy/session.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/designate/sqlalchemy/session.py b/designate/sqlalchemy/session.py
index 452b85a5..c689bdee 100644
--- a/designate/sqlalchemy/session.py
+++ b/designate/sqlalchemy/session.py
@@ -62,6 +62,10 @@ def _create_facade_lazily(cfg_group, connection=None, discriminator=None):
if cache_name not in _FACADES:
conf = dict(cfg.CONF[cfg_group].items())
+ # FIXME(stephenfin): Remove this (and ideally use of
+ # LegacyEngineFacade) asap since it's not compatible with SQLAlchemy
+ # 2.0
+ conf['autocommit'] = True
_FACADES[cache_name] = session.EngineFacade(
connection,
**conf