<p dir="auto"><strong>Migrated issue, originally created by Adrian (<a href="https://github.com/thiefmaster">@thiefmaster</a>)</strong></p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import *


Base = declarative_base()


class Item(Base):
    __tablename__ = 'items'
    id = Column(Integer, primary_key=True)
    creator_id = Column(
        Integer,
        ForeignKey('users.id'),
        index=True,
        nullable=True
    )
    creator = relationship(
        'User',
        lazy=True,
        backref=backref(
            'created_items',
            lazy=True
        )
    )
    acl_entries = relationship(
        'ACL',
        lazy=True,
        backref=backref(
            'item',
            lazy=True
        )
    )


class User(Base):
    __tablename__ = 'users'
    id = Column(Integer, primary_key=True)
    extra_id = Column(
        Integer,
        ForeignKey('extra.id'),
        index=True,
        nullable=False
    )
    extra = relationship(
        'Extra',
        lazy=True,
        backref=backref(
            'user',
            lazy=True,
            uselist=False
        )
    )


class Extra(Base):
    __tablename__ = 'extra'
    id = Column(Integer, primary_key=True)


class ACL(Base):
    __tablename__ = 'acl_entries'
    id = Column(Integer, primary_key=True)
    item_id = Column(
        Integer,
        ForeignKey('items.id'),
        index=True,
        nullable=True
    )
    user_id = Column(
        Integer,
        ForeignKey('users.id'),
        index=True,
        nullable=True
    )
    user = relationship(
        'User',
        lazy=True,
        backref=backref(
            'acl_entries',
            lazy=True
        )
    )


e = create_engine('sqlite:///:memory:', echo=True)
# e = create_engine('postgresql:///test', echo=True)
Base.metadata.create_all(e)
s = Session(e)


item = Item()
user = User(extra=Extra())
item.creator = user
item.acl_entries = [ACL(user=user)]
s.add(item)
s.flush()
s.expire_all()

print


query = (s.query(Item)
         .options(joinedload('acl_entries').joinedload('user').noload('extra'),
                  joinedload('creator').joinedload('extra')))
for item in query:
    print 'Item', item
    print 'Item.creator', item.creator
    print 'Item.creator.extra', item.creator.extra
    print 'Item.acl_entries'
    for ae in item.acl_entries:
        print ae, ae.user, ae.user.extra
"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">sqlalchemy</span> <span class="pl-k">import</span> <span class="pl-c1">*</span>
<span class="pl-k">from</span> <span class="pl-s1">sqlalchemy</span>.<span class="pl-s1">ext</span>.<span class="pl-s1">declarative</span> <span class="pl-k">import</span> <span class="pl-s1">declarative_base</span>
<span class="pl-k">from</span> <span class="pl-s1">sqlalchemy</span>.<span class="pl-s1">orm</span> <span class="pl-k">import</span> <span class="pl-c1">*</span>


<span class="pl-v">Base</span> <span class="pl-c1">=</span> <span class="pl-en">declarative_base</span>()


<span class="pl-k">class</span> <span class="pl-v">Item</span>(<span class="pl-v">Base</span>):
    <span class="pl-s1">__tablename__</span> <span class="pl-c1">=</span> <span class="pl-s">'items'</span>
    <span class="pl-s1">id</span> <span class="pl-c1">=</span> <span class="pl-v">Column</span>(<span class="pl-v">Integer</span>, <span class="pl-s1">primary_key</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
    <span class="pl-s1">creator_id</span> <span class="pl-c1">=</span> <span class="pl-v">Column</span>(
        <span class="pl-v">Integer</span>,
        <span class="pl-v">ForeignKey</span>(<span class="pl-s">'users.id'</span>),
        <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-c1">True</span>,
        <span class="pl-s1">nullable</span><span class="pl-c1">=</span><span class="pl-c1">True</span>
    )
    <span class="pl-s1">creator</span> <span class="pl-c1">=</span> <span class="pl-en">relationship</span>(
        <span class="pl-s">'User'</span>,
        <span class="pl-s1">lazy</span><span class="pl-c1">=</span><span class="pl-c1">True</span>,
        <span class="pl-s1">backref</span><span class="pl-c1">=</span><span class="pl-en">backref</span>(
            <span class="pl-s">'created_items'</span>,
            <span class="pl-s1">lazy</span><span class="pl-c1">=</span><span class="pl-c1">True</span>
        )
    )
    <span class="pl-s1">acl_entries</span> <span class="pl-c1">=</span> <span class="pl-en">relationship</span>(
        <span class="pl-s">'ACL'</span>,
        <span class="pl-s1">lazy</span><span class="pl-c1">=</span><span class="pl-c1">True</span>,
        <span class="pl-s1">backref</span><span class="pl-c1">=</span><span class="pl-en">backref</span>(
            <span class="pl-s">'item'</span>,
            <span class="pl-s1">lazy</span><span class="pl-c1">=</span><span class="pl-c1">True</span>
        )
    )


<span class="pl-k">class</span> <span class="pl-v">User</span>(<span class="pl-v">Base</span>):
    <span class="pl-s1">__tablename__</span> <span class="pl-c1">=</span> <span class="pl-s">'users'</span>
    <span class="pl-s1">id</span> <span class="pl-c1">=</span> <span class="pl-v">Column</span>(<span class="pl-v">Integer</span>, <span class="pl-s1">primary_key</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
    <span class="pl-s1">extra_id</span> <span class="pl-c1">=</span> <span class="pl-v">Column</span>(
        <span class="pl-v">Integer</span>,
        <span class="pl-v">ForeignKey</span>(<span class="pl-s">'extra.id'</span>),
        <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-c1">True</span>,
        <span class="pl-s1">nullable</span><span class="pl-c1">=</span><span class="pl-c1">False</span>
    )
    <span class="pl-s1">extra</span> <span class="pl-c1">=</span> <span class="pl-en">relationship</span>(
        <span class="pl-s">'Extra'</span>,
        <span class="pl-s1">lazy</span><span class="pl-c1">=</span><span class="pl-c1">True</span>,
        <span class="pl-s1">backref</span><span class="pl-c1">=</span><span class="pl-en">backref</span>(
            <span class="pl-s">'user'</span>,
            <span class="pl-s1">lazy</span><span class="pl-c1">=</span><span class="pl-c1">True</span>,
            <span class="pl-s1">uselist</span><span class="pl-c1">=</span><span class="pl-c1">False</span>
        )
    )


<span class="pl-k">class</span> <span class="pl-v">Extra</span>(<span class="pl-v">Base</span>):
    <span class="pl-s1">__tablename__</span> <span class="pl-c1">=</span> <span class="pl-s">'extra'</span>
    <span class="pl-s1">id</span> <span class="pl-c1">=</span> <span class="pl-v">Column</span>(<span class="pl-v">Integer</span>, <span class="pl-s1">primary_key</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)


<span class="pl-k">class</span> <span class="pl-v">ACL</span>(<span class="pl-v">Base</span>):
    <span class="pl-s1">__tablename__</span> <span class="pl-c1">=</span> <span class="pl-s">'acl_entries'</span>
    <span class="pl-s1">id</span> <span class="pl-c1">=</span> <span class="pl-v">Column</span>(<span class="pl-v">Integer</span>, <span class="pl-s1">primary_key</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
    <span class="pl-s1">item_id</span> <span class="pl-c1">=</span> <span class="pl-v">Column</span>(
        <span class="pl-v">Integer</span>,
        <span class="pl-v">ForeignKey</span>(<span class="pl-s">'items.id'</span>),
        <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-c1">True</span>,
        <span class="pl-s1">nullable</span><span class="pl-c1">=</span><span class="pl-c1">True</span>
    )
    <span class="pl-s1">user_id</span> <span class="pl-c1">=</span> <span class="pl-v">Column</span>(
        <span class="pl-v">Integer</span>,
        <span class="pl-v">ForeignKey</span>(<span class="pl-s">'users.id'</span>),
        <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-c1">True</span>,
        <span class="pl-s1">nullable</span><span class="pl-c1">=</span><span class="pl-c1">True</span>
    )
    <span class="pl-s1">user</span> <span class="pl-c1">=</span> <span class="pl-en">relationship</span>(
        <span class="pl-s">'User'</span>,
        <span class="pl-s1">lazy</span><span class="pl-c1">=</span><span class="pl-c1">True</span>,
        <span class="pl-s1">backref</span><span class="pl-c1">=</span><span class="pl-en">backref</span>(
            <span class="pl-s">'acl_entries'</span>,
            <span class="pl-s1">lazy</span><span class="pl-c1">=</span><span class="pl-c1">True</span>
        )
    )


<span class="pl-s1">e</span> <span class="pl-c1">=</span> <span class="pl-en">create_engine</span>(<span class="pl-s">'sqlite:///:memory:'</span>, <span class="pl-s1">echo</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
<span class="pl-c"># e = create_engine('postgresql:///test', echo=True)</span>
<span class="pl-v">Base</span>.<span class="pl-s1">metadata</span>.<span class="pl-en">create_all</span>(<span class="pl-s1">e</span>)
<span class="pl-s1">s</span> <span class="pl-c1">=</span> <span class="pl-v">Session</span>(<span class="pl-s1">e</span>)


<span class="pl-s1">item</span> <span class="pl-c1">=</span> <span class="pl-v">Item</span>()
<span class="pl-s1">user</span> <span class="pl-c1">=</span> <span class="pl-v">User</span>(<span class="pl-s1">extra</span><span class="pl-c1">=</span><span class="pl-v">Extra</span>())
<span class="pl-s1">item</span>.<span class="pl-s1">creator</span> <span class="pl-c1">=</span> <span class="pl-s1">user</span>
<span class="pl-s1">item</span>.<span class="pl-s1">acl_entries</span> <span class="pl-c1">=</span> [<span class="pl-v">ACL</span>(<span class="pl-s1">user</span><span class="pl-c1">=</span><span class="pl-s1">user</span>)]
<span class="pl-s1">s</span>.<span class="pl-en">add</span>(<span class="pl-s1">item</span>)
<span class="pl-s1">s</span>.<span class="pl-en">flush</span>()
<span class="pl-s1">s</span>.<span class="pl-en">expire_all</span>()

<span class="pl-s1">print</span>


<span class="pl-s1">query</span> <span class="pl-c1">=</span> (<span class="pl-s1">s</span>.<span class="pl-en">query</span>(<span class="pl-v">Item</span>)
         .<span class="pl-en">options</span>(<span class="pl-en">joinedload</span>(<span class="pl-s">'acl_entries'</span>).<span class="pl-en">joinedload</span>(<span class="pl-s">'user'</span>).<span class="pl-en">noload</span>(<span class="pl-s">'extra'</span>),
                  <span class="pl-en">joinedload</span>(<span class="pl-s">'creator'</span>).<span class="pl-en">joinedload</span>(<span class="pl-s">'extra'</span>)))
<span class="pl-k">for</span> <span class="pl-s1">item</span> <span class="pl-c1">in</span> <span class="pl-s1">query</span>:
    <span class="pl-k">print</span> <span class="pl-s">'Item'</span>, <span class="pl-s1">item</span>
    <span class="pl-k">print</span> <span class="pl-s">'Item.creator'</span>, <span class="pl-s1">item</span>.<span class="pl-s1">creator</span>
    <span class="pl-k">print</span> <span class="pl-s">'Item.creator.extra'</span>, <span class="pl-s1">item</span>.<span class="pl-s1">creator</span>.<span class="pl-s1">extra</span>
    <span class="pl-k">print</span> <span class="pl-s">'Item.acl_entries'</span>
    <span class="pl-k">for</span> <span class="pl-s1">ae</span> <span class="pl-c1">in</span> <span class="pl-s1">item</span>.<span class="pl-s1">acl_entries</span>:
        <span class="pl-k">print</span> <span class="pl-s1">ae</span>, <span class="pl-s1">ae</span>.<span class="pl-s1">user</span>, <span class="pl-s1">ae</span>.<span class="pl-s1">user</span>.<span class="pl-s1">extra</span></pre></div>
<p dir="auto">Output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Item &lt;__main__.Item object at 0x7f2df31d5450&gt;
Item.creator &lt;__main__.User object at 0x7f2df31f9050&gt;
Item.creator.extra None
Item.acl_entries
&lt;__main__.ACL object at 0x7f2df316ecd0&gt; &lt;__main__.User object at 0x7f2df31f9050&gt; None"><pre class="notranslate"><code class="notranslate">Item &lt;__main__.Item object at 0x7f2df31d5450&gt;
Item.creator &lt;__main__.User object at 0x7f2df31f9050&gt;
Item.creator.extra None
Item.acl_entries
&lt;__main__.ACL object at 0x7f2df316ecd0&gt; &lt;__main__.User object at 0x7f2df31f9050&gt; None
</code></pre></div>
<p dir="auto">I would expect <code class="notranslate">Item.creator.extra</code> to be available. This example is based on a real application where I don't care about certain User relationships when loading the ACL for an object (so i <code class="notranslate">noload</code> them), but at the same time I do need the data from the relationship for the "creator" of the object (which is a relationship between Item and User).</p>
<p dir="auto">The data is actually queried, but apparently discarded somewhere within SQLAlchemy:</p>
<div class="highlight highlight-source-sql notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="SELECT items.id AS items_id,
       items.creator_id AS items_creator_id,
       extra_1.id AS extra_1_id,
       users_1.id AS users_1_id,
       users_1.extra_id AS users_1_extra_id,
       users_2.id AS users_2_id,
       users_2.extra_id AS users_2_extra_id,
       acl_entries_1.id AS acl_entries_1_id,
       acl_entries_1.item_id AS acl_entries_1_item_id,
       acl_entries_1.user_id AS acl_entries_1_user_id
FROM items
LEFT OUTER JOIN users AS users_1 ON users_1.id = items.creator_id
LEFT OUTER JOIN extra AS extra_1 ON extra_1.id = users_1.extra_id
LEFT OUTER JOIN acl_entries AS acl_entries_1 ON items.id = acl_entries_1.item_id
LEFT OUTER JOIN users AS users_2 ON users_2.id = acl_entries_1.user_id"><pre class="notranslate"><span class="pl-k">SELECT</span> <span class="pl-c1">items</span>.<span class="pl-c1">id</span> <span class="pl-k">AS</span> items_id,
       <span class="pl-c1">items</span>.<span class="pl-c1">creator_id</span> <span class="pl-k">AS</span> items_creator_id,
       <span class="pl-c1">extra_1</span>.<span class="pl-c1">id</span> <span class="pl-k">AS</span> extra_1_id,
       <span class="pl-c1">users_1</span>.<span class="pl-c1">id</span> <span class="pl-k">AS</span> users_1_id,
       <span class="pl-c1">users_1</span>.<span class="pl-c1">extra_id</span> <span class="pl-k">AS</span> users_1_extra_id,
       <span class="pl-c1">users_2</span>.<span class="pl-c1">id</span> <span class="pl-k">AS</span> users_2_id,
       <span class="pl-c1">users_2</span>.<span class="pl-c1">extra_id</span> <span class="pl-k">AS</span> users_2_extra_id,
       <span class="pl-c1">acl_entries_1</span>.<span class="pl-c1">id</span> <span class="pl-k">AS</span> acl_entries_1_id,
       <span class="pl-c1">acl_entries_1</span>.<span class="pl-c1">item_id</span> <span class="pl-k">AS</span> acl_entries_1_item_id,
       <span class="pl-c1">acl_entries_1</span>.<span class="pl-c1">user_id</span> <span class="pl-k">AS</span> acl_entries_1_user_id
<span class="pl-k">FROM</span> items
<span class="pl-k">LEFT OUTER JOIN</span> users <span class="pl-k">AS</span> users_1 <span class="pl-k">ON</span> <span class="pl-c1">users_1</span>.<span class="pl-c1">id</span> <span class="pl-k">=</span> <span class="pl-c1">items</span>.<span class="pl-c1">creator_id</span>
<span class="pl-k">LEFT OUTER JOIN</span> extra <span class="pl-k">AS</span> extra_1 <span class="pl-k">ON</span> <span class="pl-c1">extra_1</span>.<span class="pl-c1">id</span> <span class="pl-k">=</span> <span class="pl-c1">users_1</span>.<span class="pl-c1">extra_id</span>
<span class="pl-k">LEFT OUTER JOIN</span> acl_entries <span class="pl-k">AS</span> acl_entries_1 <span class="pl-k">ON</span> <span class="pl-c1">items</span>.<span class="pl-c1">id</span> <span class="pl-k">=</span> <span class="pl-c1">acl_entries_1</span>.<span class="pl-c1">item_id</span>
<span class="pl-k">LEFT OUTER JOIN</span> users <span class="pl-k">AS</span> users_2 <span class="pl-k">ON</span> <span class="pl-c1">users_2</span>.<span class="pl-c1">id</span> <span class="pl-k">=</span> <span class="pl-c1">acl_entries_1</span>.<span class="pl-c1">user_id</span></pre></div>
<p dir="auto"><strong>Migrated issue, originally created by Michael Bayer (<a href="https://github.com/zzzeek">@zzzeek</a>)</strong></p>
<p dir="auto">test:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()


class A(Base):
    __tablename__ = 'a'
    id = Column(Integer, primary_key=True)
    b_id = Column(ForeignKey('b.id'))
    c_id = Column(ForeignKey('c.id'))

    b = relationship(&quot;B&quot;)
    c = relationship(&quot;C&quot;)


class B(Base):
    __tablename__ = 'b'
    id = Column(Integer, primary_key=True)
    c_id = Column(ForeignKey('c.id'))

    c = relationship(&quot;C&quot;)


class C(Base):
    __tablename__ = 'c'
    id = Column(Integer, primary_key=True)
    d_id = Column(ForeignKey('d.id'))
    d = relationship(&quot;D&quot;)


class D(Base):
    __tablename__ = 'd'
    id = Column(Integer, primary_key=True)


e = create_engine(&quot;sqlite://&quot;, echo=True)
Base.metadata.create_all(e)

s = Session(e)

c = C(d=D())

s.add(
    A(b=B(c=c), c=c)
)
s.commit()

c_alias_1 = aliased(C)
c_alias_2 = aliased(C)

q = s.query(A)
q = q.join(A.b).join(c_alias_1, B.c).join(c_alias_1.d)
q = q.options(contains_eager(A.b).contains_eager(B.c, alias=c_alias_1).contains_eager(C.d))
q = q.join(c_alias_2, A.c)
q = q.options(contains_eager(A.c, alias=c_alias_2))


a1 = q.all()[0]
assert 'd' in a1.c.__dict__

"><pre class="notranslate"><code class="notranslate">from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()


class A(Base):
    __tablename__ = 'a'
    id = Column(Integer, primary_key=True)
    b_id = Column(ForeignKey('b.id'))
    c_id = Column(ForeignKey('c.id'))

    b = relationship("B")
    c = relationship("C")


class B(Base):
    __tablename__ = 'b'
    id = Column(Integer, primary_key=True)
    c_id = Column(ForeignKey('c.id'))

    c = relationship("C")


class C(Base):
    __tablename__ = 'c'
    id = Column(Integer, primary_key=True)
    d_id = Column(ForeignKey('d.id'))
    d = relationship("D")


class D(Base):
    __tablename__ = 'd'
    id = Column(Integer, primary_key=True)


e = create_engine("sqlite://", echo=True)
Base.metadata.create_all(e)

s = Session(e)

c = C(d=D())

s.add(
    A(b=B(c=c), c=c)
)
s.commit()

c_alias_1 = aliased(C)
c_alias_2 = aliased(C)

q = s.query(A)
q = q.join(A.b).join(c_alias_1, B.c).join(c_alias_1.d)
q = q.options(contains_eager(A.b).contains_eager(B.c, alias=c_alias_1).contains_eager(C.d))
q = q.join(c_alias_2, A.c)
q = q.options(contains_eager(A.c, alias=c_alias_2))


a1 = q.all()[0]
assert 'd' in a1.c.__dict__


</code></pre></div>
<p dir="auto">this test relies on the order in which we load attributes, and for some reason PYTHONHASHSEED isn't doing the job in all cases, so test with this patch:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="diff --git a/lib/sqlalchemy/orm/loading.py b/lib/sqlalchemy/orm/loading.py
index 50afaf6..8de66de 100644
--- a/lib/sqlalchemy/orm/loading.py
+++ b/lib/sqlalchemy/orm/loading.py
@@ -295,6 +295,13 @@ def _instance_processor(
     quick_populators = path.get(
         context.attributes, &quot;memoized_setups&quot;, _none_set)
 
+    import random
+    props = list(props)
+    random.shuffle(props)
+
+    print(
+        &quot;PROPS!!!!&quot;,[p.key for p in props]
+    )
     for prop in props:
         if prop in quick_populators:"><pre class="notranslate"><code class="notranslate">diff --git a/lib/sqlalchemy/orm/loading.py b/lib/sqlalchemy/orm/loading.py
index 50afaf6..8de66de 100644
--- a/lib/sqlalchemy/orm/loading.py
+++ b/lib/sqlalchemy/orm/loading.py
@@ -295,6 +295,13 @@ def _instance_processor(
     quick_populators = path.get(
         context.attributes, "memoized_setups", _none_set)
 
+    import random
+    props = list(props)
+    random.shuffle(props)
+
+    print(
+        "PROPS!!!!",[p.key for p in props]
+    )
     for prop in props:
         if prop in quick_populators:
</code></pre></div>
<p dir="auto">there's no way to force this loader to happen in all cases because ultimately when the C object is already there, the "isnew" flag is not set and we naturally hit the "existing" loader.  However, the "existing" loader <em>can</em> do a check here and populate the key, and we are checking anyway:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py
index 78e9293..dff51b9 100644
--- a/lib/sqlalchemy/orm/strategies.py
+++ b/lib/sqlalchemy/orm/strategies.py
@@ -1559,13 +1559,15 @@ 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 \
-                and key in dict_ \
-                    and existing is not dict_[key]:
-                util.warn(
-                    &quot;Multiple rows returned with &quot;
-                    &quot;uselist=False for eagerly-loaded attribute '%s' &quot;
-                    % self)
+            if existing is not None:
+                if key in dict_:
+                    if existing is not dict_[key]:
+                        util.warn(
+                            &quot;Multiple rows returned with &quot;
+                            &quot;uselist=False for eagerly-loaded attribute '%s' &quot;
+                            % self)
+                else:
+                    dict_[key] = existing
 
         def load_scalar_from_joined_exec(state, dict_, row):
             _instance(row)

             # this is an inlined path just for column-based attributes."><pre class="notranslate"><code class="notranslate">diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py
index 78e9293..dff51b9 100644
--- a/lib/sqlalchemy/orm/strategies.py
+++ b/lib/sqlalchemy/orm/strategies.py
@@ -1559,13 +1559,15 @@ 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 \
-                and key in dict_ \
-                    and existing is not dict_[key]:
-                util.warn(
-                    "Multiple rows returned with "
-                    "uselist=False for eagerly-loaded attribute '%s' "
-                    % self)
+            if existing is not None:
+                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:
+                    dict_[key] = existing
 
         def load_scalar_from_joined_exec(state, dict_, row):
             _instance(row)

             # this is an inlined path just for column-based attributes.
</code></pre></div>
<p dir="auto">would need to do the deep thinking here to see if this is right.</p>