Hi,

I have prepared a sample of code to ilustrate this behaviour :)

Summarizing:

session.expunge_all()
n2 =
session.query(Node).filter_by(name='n2').options(joinedload('ancestors')).one()
print n2.ancestors


AND:

session.expunge_all()
n2 = session.query(Node).filter_by(name='n2').one()
n2 =
session.query(Node).filter_by(name='n2').options(joinedload('ancestors')).one()
print n2.ancestors


do NOT produce the same result when the collection is lazy='noload'.

In the latter, the collection is empty, even after we fetch its contents
with a joinedload.


2013/1/23 Pau Tallada <tall...@pic.es>

> Ok, thank you very much :D
>
> I'll keep poking, and i'll try to provide a sample code :P
>
>
> 2013/1/23 Michael Bayer <mike...@zzzcomputing.com>
>
>>
>> On Jan 23, 2013, at 6:49 AM, Pau Tallada wrote:
>>
>> >
>> > One final comment. With the contains_eager query, the instances that
>> are part of the collection are retrieved from the database but not stored
>> on the identity_map. Is that also the expected behaviour, isn't it?
>>
>> I need to read your whole email more closely but on this point, that's
>> not true at all.  Every object that the Session loads from the database
>> goes directly to the identity map.    The identity map is weak referencing,
>> so if no other references remain to a particular object, it will disappear
>> from the identity map also, but that implies that object is not accessible
>> anywhere else either.
>>
>> Since it seems like you've been poking around, you might want to continue
>> poking around some more given that information until I have time to look at
>> the rest of your email.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sqlalchemy" group.
>> To post to this group, send email to sqlalchemy@googlegroups.com.
>> To unsubscribe from this group, send email to
>> sqlalchemy+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/sqlalchemy?hl=en.
>>
>>
>
>
> --
> ----------------------------------
> Pau Tallada Crespí
> Dep. d'Astrofísica i Cosmologia
> Port d'Informació Científica (PIC)
> Tel: +34 93 586 8233
> ----------------------------------
>
>


-- 
----------------------------------
Pau Tallada Crespí
Dep. d'Astrofísica i Cosmologia
Port d'Informació Científica (PIC)
Tel: +34 93 586 8233
----------------------------------

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Attachment: noload.py
Description: Binary data

Reply via email to