Add support of sqlachemy 2.0
Change-Id: I96b0e9f22753ee9173a921919d78edf646a4fc89
This commit is contained in:
parent
5eb7e702ad
commit
f557061d23
@ -16,6 +16,7 @@ import time
|
|||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
|
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
|
from sqlalchemy import text
|
||||||
from tempest.lib import exceptions
|
from tempest.lib import exceptions
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -62,13 +63,11 @@ class SQLClient(object):
|
|||||||
|
|
||||||
def conn_execute(self, conn, cmds):
|
def conn_execute(self, conn, cmds):
|
||||||
if isinstance(cmds, str):
|
if isinstance(cmds, str):
|
||||||
result = conn.execute(cmds)
|
result = conn.execute(text(cmds))
|
||||||
# Returns a ResultProxy
|
|
||||||
# https://docs.sqlalchemy.org/en/13/core/connections.html#sqlalchemy.engine.ResultProxy
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
for cmd in cmds:
|
for cmd in cmds:
|
||||||
conn.execute(cmd)
|
conn.execute(text(cmd))
|
||||||
|
|
||||||
def pgsql_execute(self, cmds, **kwargs):
|
def pgsql_execute(self, cmds, **kwargs):
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user