]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Raise informative error when non-object m2o comparison used
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 19 Apr 2020 20:52:54 +0000 (16:52 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 19 Apr 2020 20:55:03 +0000 (16:55 -0400)
commit63c94343a317e1201101027e2cb32fef2437f75d
tree6941f1f3bb09553c7fbc75dd8b7de30e14e57a99
parent362d0036cf003208f31a162d7e7ec2ae54c3cc0d
Raise informative error when non-object m2o comparison used

An informative error message is raised when an ORM many-to-one comparison
is attempted against an object that is not an actual mapped instance.
Comparisons such as those to scalar subqueries aren't supported;
generalized comparison with subqueries is better achieved using
:meth:`~.RelationshipProperty.Comparator.has`.

Fixes: #5269
Change-Id: I2e23178eb59728c39241a46bfa7411239a87492e
(cherry picked from commit 430ce5eab26d46301ae741f9068f13ba09907d8e)
doc/build/changelog/unreleased_13/5269.rst [new file with mode: 0644]
lib/sqlalchemy/orm/relationships.py
test/orm/test_query.py