summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/base.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-03-21 17:26:24 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2020-03-22 11:47:59 -0400
commitbecab22dcbe9d68b0671a9246e022c9810f7e319 (patch)
treee9dee7d56ca0509ee08ffde195eb2f0791e9f158 /lib/sqlalchemy/orm/base.py
parenta25e2e02e108551d2910171202fd91fdaeb8162c (diff)
downloadsqlalchemy-becab22dcbe9d68b0671a9246e022c9810f7e319.tar.gz
Test instance for matching class hierarchy on get_from_identity
Fixed issue where a lazyload that uses session-local "get" against a target many-to-one relationship where an object with the correct primary key is present, however it's an instance of a sibling class, does not correctly return None as is the case when the lazy loader actually emits a load for that row. Fixes: #5210 Change-Id: I89f9946cfeba61d89a272435f76a5a082b1da30c
Diffstat (limited to 'lib/sqlalchemy/orm/base.py')
-rw-r--r--lib/sqlalchemy/orm/base.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/base.py b/lib/sqlalchemy/orm/base.py
index a31745aec..6df8acf1e 100644
--- a/lib/sqlalchemy/orm/base.py
+++ b/lib/sqlalchemy/orm/base.py
@@ -25,6 +25,13 @@ PASSIVE_NO_RESULT = util.symbol(
""",
)
+PASSIVE_CLASS_MISMATCH = util.symbol(
+ "PASSIVE_CLASS_MISMATCH",
+ """Symbol indicating that an object is locally present for a given
+ primary key identity but it is not of the requested class. The
+ return value is therefore None and no SQL should be emitted.""",
+)
+
ATTR_WAS_SET = util.symbol(
"ATTR_WAS_SET",
"""Symbol returned by a loader callable to indicate the