From 96345af0cb157dc336a4a2e874d2bc803e0e9c3b Mon Sep 17 00:00:00 2001 From: Andriy Kurilin Date: Sat, 20 Apr 2024 10:18:36 -0400 Subject: [PATCH] Revert "Remove usage of LegacyEngineFacade" Temporary reverts commit 01018c1b1ea5dbe7fd360f62de9fbf6f239a34ed. This change will be added back as a part of bigger commit Change-Id: I45600b817cada2266341afa0ac9dbfec6ce7e62e --- rally/common/db/api.py | 13 ++++--------- tox.ini | 1 + 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/rally/common/db/api.py b/rally/common/db/api.py index f3e78d046b..fe7f3c2f5d 100644 --- a/rally/common/db/api.py +++ b/rally/common/db/api.py @@ -47,7 +47,7 @@ import time from oslo_db import exception as db_exc from oslo_db import options as db_options -from oslo_db.sqlalchemy import enginefacade +from oslo_db.sqlalchemy import session as db_session import sqlalchemy as sa import sqlalchemy.orm # noqa @@ -71,19 +71,14 @@ def _create_facade_lazily(): global _FACADE if _FACADE is None: - ctx = enginefacade.transaction_context() - ctx.configure( - sqlite_fk=False, - __autocommit=False, - expire_on_commit=False - ) - _FACADE = ctx + _FACADE = db_session.EngineFacade.from_config(CONF) return _FACADE def get_engine(): - return _create_facade_lazily().writer.get_engine() + facade = _create_facade_lazily() + return facade.get_engine() def get_session(): diff --git a/tox.ini b/tox.ini index 2392ece317..3fa17abaaf 100644 --- a/tox.ini +++ b/tox.ini @@ -137,6 +137,7 @@ commands = \ [pytest] filterwarnings = error + ignore:.*EngineFacade is deprecated; please use oslo_db.sqlalchemy.enginefacade*: # Introduced with oslo.db-12.1.0 ignore:.*Support for the MySQL NDB Cluster storage engine has been deprecated and will be removed in a future release.:DeprecationWarning: # Introduced with SQLAlchemy-1.4.46, can be removed when rally supports SQLAlchemy>=2.0.0