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: I57b8cce28c2ad7899b831067c94b9d913f3f1334
This commit is contained in:
Stephen Finucane 2022-09-05 17:38:58 +01:00
parent f98d164be9
commit ba81ce0cb1
1 changed files with 3 additions and 1 deletions

View File

@ -65,7 +65,9 @@ LOG = logging.getLogger(__name__)
# TODO(sbaker): fix tests so that sqlite_fk=True can be passed to configure
db_context.configure()
# FIXME(stephenfin): we need to remove reliance on autocommit semantics ASAP
# since it's not compatible with SQLAlchemy 2.0
db_context.configure(__autocommit=True)
def get_facade():