From d638b011bb5fc24a22042041baafba590685a098 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Wed, 27 Sep 2023 13:35:10 +0100 Subject: [PATCH] db: Wrap raw SQL query in sqlalchemy.text Another change in SQLAlchemy 2.x. Change-Id: I31123c70c9664844181eeaaf9d0846a319af7c2c Signed-off-by: Stephen Finucane --- placement/objects/resource_class.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/placement/objects/resource_class.py b/placement/objects/resource_class.py index d68e00d05..e8c1bd794 100644 --- a/placement/objects/resource_class.py +++ b/placement/objects/resource_class.py @@ -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",