oslo.db/oslo_db/sqlalchemy
Mike Bayer af4b2263e4 Resolve SAWarning in Query.soft_delete()
We currently see a lot of warnings like this from
the soft_delete() method:

  sqlalchemy.exc.SAWarning: Evaluating non-mapped column expression
  'updated_at' onto ORM instances; this is a deprecated use case.
  Please make use of the actual mapped columns in ORM-evaluated
  UPDATE / DELETE expressions.

This is because the "evaluate" synchronization strategy would like
to search for objects and update them based on the UPDATE criteria
passed, however the columns given, literal_column('id'),
literal_column('updated_at'), are not mapped to anything. The
evaluator has to make a guess that the string contained in these
expressions should be matched to a mapped attribute on the given
entity and this guess was first removed in [1], then added back in
[2] with a warning (likely since oslo.db is invoking it).

This uses the actual entity-mapped column for the query rather
than the literal string column.

[1] https://docs.sqlalchemy.org/en/latest/changelog/changelog_12.html#change-b1e620dece39006ab44c47044e9a6fee
[2] https://docs.sqlalchemy.org/en/latest/changelog/changelog_12.html#change-dff3a469788c81a46440584406cb22be

Change-Id: I192e84ce757d12d33085a209dd58d8ea46fb90fb
Closes-Bug: #1814199
2019-02-01 11:57:40 -05:00
..
compat Workaround non-compatible type.adapt() for SQLAlchemy < 1.1 2017-08-10 17:23:59 -04:00
migration_cli Remove log translations 2017-03-30 08:42:42 +08:00
__init__.py Move files out of the namespace package 2014-12-24 13:28:48 +02:00
enginefacade.py Merge "Move warnings to their own module" 2018-10-30 03:35:54 +00:00
engines.py Remove convert_unicode flag 2018-12-21 12:50:25 -05:00
exc_filters.py Fix FOREIGN KEY messages for MariaDB 10.2, 10.3 2018-08-30 17:52:09 -04:00
migration.py Throw DBMigrationError instead of DbMigrationError. 2017-09-08 11:54:09 +08:00
models.py Replace six.iteritems() with .items() 2017-07-19 14:13:15 +08:00
ndb.py Remove AutoString* in ndb.py 2017-09-04 19:25:57 +08:00
orm.py Resolve SAWarning in Query.soft_delete() 2019-02-01 11:57:40 -05:00
provision.py Remove provisioned_engine in class BackendImpl 2017-09-05 23:52:13 +08:00
session.py turn on warning-is-error in doc build 2017-07-03 11:28:14 +00:00
test_base.py Ensure all test fixtures in oslo_db.tests are private 2018-03-02 16:39:56 -05:00
test_fixtures.py Merge "Remove function optimize_db_test_loader in test_base.py" 2018-01-05 06:38:03 +00:00
test_migrations.py Remove most server_default comparison logic 2018-06-15 13:31:38 +10:00
types.py Replace ndb "auto" types with unified String 2017-07-28 11:29:42 -06:00
update_match.py Update hacking version 2019-01-03 00:53:13 +08:00
utils.py add bandit to pep8 job 2017-12-22 10:10:59 +08:00