db: Wrap raw SQL query in sqlalchemy.text

Another change in SQLAlchemy 2.x.

Change-Id: I31123c70c9664844181eeaaf9d0846a319af7c2c
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2023-09-27 13:35:10 +01:00
parent 141780c0ce
commit d638b011bb
1 changed files with 3 additions and 1 deletions

View File

@ -244,7 +244,9 @@ def _resource_classes_sync(ctx):
# of the resource class ids from the previous style of
# managing them. In some mysql settings a 0 is the same as
# "give me a default key".
conn.execute("SET SESSION SQL_MODE='NO_AUTO_VALUE_ON_ZERO'")
conn.execute(
sa.text("SET SESSION SQL_MODE='NO_AUTO_VALUE_ON_ZERO'")
)
try:
ctx.session.execute(ins, batch_args)
LOG.debug("Synced resource_classes from os_resource_classes: %s",