From 43142792502afe5e5ce29a4cc3c291f673ef066e Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Mon, 16 Aug 2021 15:37:34 +0100 Subject: [PATCH] Add missing 'connect' wrapper This was missed in change Ib789cd4d11a3d5dd01fcdb99822025b11bbc234e ("Don't rely on implicit autocommit") Change-Id: I9ec27650ae5e36099a6d2b2d59bb66cd820e8ffc Signed-off-by: Stephen Finucane --- oslo_db/sqlalchemy/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/oslo_db/sqlalchemy/utils.py b/oslo_db/sqlalchemy/utils.py index 3a6a993e..e5b35311 100644 --- a/oslo_db/sqlalchemy/utils.py +++ b/oslo_db/sqlalchemy/utils.py @@ -1162,7 +1162,9 @@ def get_non_ndbcluster_tables(connectable, skip_tables=None): params['database'] = connectable.engine.url.database query = text(query_str) - nonndbcluster = connectable.execute(query, **params) + # TODO(stephenfin): What about if this is already a Connection? + with connectable.connect() as conn, conn.begin(): + nonndbcluster = connectable.execute(query, **params) return [i[0] for i in nonndbcluster]