Browse Source

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
changes/42/758142/2
Mike Bayer 8 months ago
committed by Hervé Beraud
parent
commit
f2a94b6f1a
1 changed files with 3 additions and 4 deletions
  1. +3
    -4
      oslo_db/sqlalchemy/update_match.py

+ 3
- 4
oslo_db/sqlalchemy/update_match.py View File

@ -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


Loading…
Cancel
Save