summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Finucane <stephenfin@redhat.com>2021-07-16 19:16:36 +0100
committerStephen Finucane <stephenfin@redhat.com>2021-08-10 16:53:47 +0100
commitd2f101cdfee0fd4e98c02d1ac8034f83c51ae82c (patch)
tree1c983b526417ad1a4565eb2b9da8f6e06d0c6c11
parent0816efca7b56032b10155bdf03daec3900b4ccd7 (diff)
downloadoslo-db-d2f101cdfee0fd4e98c02d1ac8034f83c51ae82c.tar.gz
Replace use of update.whereclause parameter
Resolve the following RemovedIn20Warning: The update.whereclause parameter will be removed in SQLAlchemy 2.0. Please refer to the Update.where() method. Change-Id: I50064d16de6e1951b2282fcf9548a0ff2cd0fe55 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
-rw-r--r--oslo_db/sqlalchemy/update_match.py4
-rw-r--r--oslo_db/tests/fixtures.py5
2 files changed, 3 insertions, 6 deletions
diff --git a/oslo_db/sqlalchemy/update_match.py b/oslo_db/sqlalchemy/update_match.py
index 0bfcfa8..559aa78 100644
--- a/oslo_db/sqlalchemy/update_match.py
+++ b/oslo_db/sqlalchemy/update_match.py
@@ -487,7 +487,9 @@ def _update_stmt_from_query(mapper, query, values):
primary_table = inspect(query.column_descriptions[0]['entity']).local_table
where_criteria = query.whereclause
update_stmt = sql.update(
- primary_table, where_criteria,
+ primary_table,
+ ).where(
+ where_criteria,
).values(upd_values)
return update_stmt
diff --git a/oslo_db/tests/fixtures.py b/oslo_db/tests/fixtures.py
index d5552b0..8e70458 100644
--- a/oslo_db/tests/fixtures.py
+++ b/oslo_db/tests/fixtures.py
@@ -104,11 +104,6 @@ class WarningsFixture(fixtures.Fixture):
warnings.filterwarnings(
'once',
- message=r'The update.whereclause parameter will be removed .*',
- category=sqla_exc.SADeprecationWarning)
-
- warnings.filterwarnings(
- 'once',
message=r'The Engine.scalar\(\) method is considered legacy .*',
category=sqla_exc.SADeprecationWarning)