From f557061d23f7f7dc335a196d4139abfebfadcfc5 Mon Sep 17 00:00:00 2001 From: "wu.chunyang" Date: Sat, 8 Jun 2024 13:56:45 +0800 Subject: [PATCH] Add support of sqlachemy 2.0 Change-Id: I96b0e9f22753ee9173a921919d78edf646a4fc89 --- trove_tempest_plugin/tests/utils.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/trove_tempest_plugin/tests/utils.py b/trove_tempest_plugin/tests/utils.py index b15335c..925a147 100644 --- a/trove_tempest_plugin/tests/utils.py +++ b/trove_tempest_plugin/tests/utils.py @@ -16,6 +16,7 @@ import time from oslo_log import log as logging from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT import sqlalchemy +from sqlalchemy import text from tempest.lib import exceptions LOG = logging.getLogger(__name__) @@ -62,13 +63,11 @@ class SQLClient(object): def conn_execute(self, conn, cmds): if isinstance(cmds, str): - result = conn.execute(cmds) - # Returns a ResultProxy - # https://docs.sqlalchemy.org/en/13/core/connections.html#sqlalchemy.engine.ResultProxy + result = conn.execute(text(cmds)) return result for cmd in cmds: - conn.execute(cmd) + conn.execute(text(cmd)) def pgsql_execute(self, cmds, **kwargs): try: