On Jan 14, 2014, at 4:36 PM, [email protected] wrote:

> Help!
> 
> I'm employing a cache strategy which saves Model instances to an in-memory 
> store. When I retrieve these instances from the cache, I add them to my 
> session. All the data is there, but when I try to use a relationship property 
> it returns None.

“use”, like, my_instance.some_other_object returns None?   What kind of SQL 
output do you see when you hit that attribute?  How is “my_instance” being 
created in the first place?


> 
> A test with two objects: cache_obj and fresh_obj, the only difference I see 
> is that one has a unicode string for it's foreign key and the other does not 
> (which is also strange).
> 
> (Pdb)  fresh_obj_map.attrs['profile'].target == cache_obj_map.attrs['profile']
> True
> 
> (Pdb) cache_obj.profile_id
> '2cedffc2-7d5c-11e3-8cb0-c82a1412a8b6'
> 
> (Pdb) fresh_obj.profile_id
> u'2cedffc2-7d5c-11e3-8cb0-c82a1412a8b6'
> 
> (Pdb) cache_obj.profile
> 
> (Pdb) fresh_obj.profile
> <alphaworks.models.profile.Profile object at 0x10215e910>

if profile_id is a string column all the way then the u’’ ‘’ difference 
shouldn’t be much of an issue.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to