SAWarning: Evaluating non-mapped column expression 'id' onto ORM instances; this is a deprecated use case. Please make use of the actual mapped columns in ORM-evaluated UPDATE / DELETE expressions.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
oslo.db |
Confirmed
|
Medium
|
Unassigned |
Bug Description
This is split off from bug 1813147 but py35 unit test jobs have a ton of these SAWarnings (at least in nova):
There are 866 hits of that SAWarning in that single run which causes intermittent issues with the stestr subunit parser.
Here is an example of a stacktrace from nova master:
nova.tests.
-------
Captured pythonlogging:
~~~~~~~
b'2019-01-31 17:48:15,014 INFO [248_add_
b''
Captured traceback:
~~~~~~~~~~~~~~~~~~~
b'Traceback (most recent call last):'
b' File "/home/
b" db.instance_
b' File "/home/
b' return IMPL.instance_
b' File "/home/
b' return f(*args, **kwargs)'
b' File "/home/
b' ectxt.value = e.inner_exc'
b' File "/home/
b' self.force_
b' File "/home/
b' six.reraise(
b' File "/home/
b' raise value'
b' File "/home/
b' return f(*args, **kwargs)'
b' File "/home/
b' return f(context, *args, **kwargs)'
b' File "/home/
b' count = query.soft_
b' File "/home/
b' synchronize_
b' File "/home/
b' update_op.exec_()'
b' File "/home/
b' self._do_
b' File "/home/
b' self._additiona
b' File "/home/
b' expression.
b' File "/home/
b' return meth(clause)'
b' File "/home/
b' "UPDATE / DELETE expressions." % clause)'
b' File "/home/
b' warnings.warn(msg, exc.SAWarning, stacklevel=2)'
b"sqlalchem
b''
It seems the problem stems from this code:
https:/
I'm not really sure how to fix that though, will need help from Mike Bayer.
so this is a bug in oslo.db, for which soft_delete() should not be written that way, since it is wrong.
The immediate mitigation is to pass in synchronize_ session= False so that the ORM evaluator isn't pulled in, which is the element that has to make a guess when those non-mapped columns are passed in.
longer term, the method in oslo.db needs to be fixed. issue with the correct code is added in https:/ /bugs.launchpad .net/oslo. db/+bug/ 1814199.