diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-10-14 10:39:43 -0400 |
---|---|---|
committer | Hervé Beraud <hberaud@redhat.com> | 2021-04-28 12:12:09 +0200 |
commit | f2a94b6f1a8d1c2274ff81ae9968d22a22fd8503 (patch) | |
tree | 774c5f42e6341b78955d01eb45056b1b793c2ee8 /oslo_db | |
parent | f37269ae603bc0e09210379e03a476ff2193c74c (diff) | |
download | oslo-db-f2a94b6f1a8d1c2274ff81ae9968d22a22fd8503.tar.gz |
Don't use private API to get query criteria
Another change for SQLAlchemy 1.4 is the mechanics
of how the ``QueryContext`` object works. Update the
update_match extension such that it does not rely upon the
``QueryContext`` object and uses public APIs instead.
Change-Id: I27e20e59bce8c98b5a507c617364652aa6eb33f5
Diffstat (limited to 'oslo_db')
-rw-r--r-- | oslo_db/sqlalchemy/update_match.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/oslo_db/sqlalchemy/update_match.py b/oslo_db/sqlalchemy/update_match.py index 8e139e9..577fb81 100644 --- a/oslo_db/sqlalchemy/update_match.py +++ b/oslo_db/sqlalchemy/update_match.py @@ -484,11 +484,10 @@ def _update_stmt_from_query(mapper, query, values): mapper.column_attrs[key], value ) for key, value in values.items() ) - query = query.enable_eagerloads(False) - context = query._compile_context() - primary_table = context.statement.froms[0] + primary_table = inspect(query.column_descriptions[0]['entity']).local_table + where_criteria = query.whereclause update_stmt = sql.update(primary_table, - context.whereclause, + where_criteria, upd_values) return update_stmt |