diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-10-03 16:55:54 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-10-04 12:07:08 -0400 |
commit | c3abfe50645abdb27e41639701a68d2e6eaeff2c (patch) | |
tree | 2dc506ea94a33229ff424710f8facf1049f29f5e /lib | |
parent | 728ce8cc480d0ada690e5a97067cff821b9a65f3 (diff) | |
download | sqlalchemy-c3abfe50645abdb27e41639701a68d2e6eaeff2c.tar.gz |
Honor additional row coming in with value of None
The change in #3431 still checks that the instance() is
non-None, deferring to other loading schemes if it is.
These columns are dedicated towards the entity however, so if the value
is None, we should set it. If it conflicts, we are detecting that
in any case.
Change-Id: I223768e2898e843f953e910da1f9564b137d95e4
Fixes: #3811
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sqlalchemy/orm/strategies.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py index 202b652b7..41d5dd9a3 100644 --- a/lib/sqlalchemy/orm/strategies.py +++ b/lib/sqlalchemy/orm/strategies.py @@ -1616,19 +1616,19 @@ class JoinedLoader(AbstractRelationshipLoader): # call _instance on the row, even though the object has # been created, so that we further descend into properties existing = _instance(row) - if existing is not None: - # conflicting value already loaded, this shouldn't happen - if key in dict_: - if existing is not dict_[key]: - util.warn( - "Multiple rows returned with " - "uselist=False for eagerly-loaded attribute '%s' " - % self) - else: - # this case is when one row has multiple loads of the - # same entity (e.g. via aliasing), one has an attribute - # that the other doesn't. - dict_[key] = existing + + # conflicting value already loaded, this shouldn't happen + if key in dict_: + if existing is not dict_[key]: + util.warn( + "Multiple rows returned with " + "uselist=False for eagerly-loaded attribute '%s' " + % self) + else: + # this case is when one row has multiple loads of the + # same entity (e.g. via aliasing), one has an attribute + # that the other doesn't. + dict_[key] = existing def load_scalar_from_joined_exec(state, dict_, row): _instance(row) |