Re: [sqlalchemy] interaction between lazy=noload and contains_eager()

2013-01-30 Thread Pau Tallada
Oh, sorry, i supposed thaty contains_eager only worked for relationships, and not for other kind of attributes :D That's great! Thanks! 2013/1/28 Michael Bayer mike...@zzzcomputing.com what additional behaviors are you looking for that the @property approach isn't giving you ? Options

Re: [sqlalchemy] interaction between lazy=noload and contains_eager()

2013-01-28 Thread Pau Tallada
Hi, Sorry to insist on this :P But there is any way to get this kind of behaviour, the virtual column/relationship? Thanks! Pau. 2013/1/24 Pau Tallada tall...@pic.es Hi Michael, As always, thank you very much for your dedication :) I recognize that I am always trying to reach the edges of

Re: [sqlalchemy] interaction between lazy=noload and contains_eager()

2013-01-28 Thread Michael Bayer
what additional behaviors are you looking for that the @property approach isn't giving you ? Options include turning it into a synonym() which would allow it to be a little bit more transparent. On Jan 28, 2013, at 4:55 AM, Pau Tallada wrote: Hi, Sorry to insist on this :P But

[sqlalchemy] interaction between lazy=noload and contains_eager()

2013-01-23 Thread Pau Tallada
Hi! I have a tree structure modeled into a database using adjacency-list paradigm (so having a reference to the parent). class Node(Base): id= Column(Integer, primary_key=True) name = Column(String(120)) parent_id = Column(Integer, ForeignKey('id')) I'm adding some custom

Re: [sqlalchemy] interaction between lazy=noload and contains_eager()

2013-01-23 Thread Michael Bayer
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

Re: [sqlalchemy] interaction between lazy=noload and contains_eager()

2013-01-23 Thread Pau Tallada
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

Re: [sqlalchemy] interaction between lazy=noload and contains_eager()

2013-01-23 Thread Pau Tallada
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 =

Re: [sqlalchemy] interaction between lazy=noload and contains_eager()

2013-01-23 Thread Michael Bayer
On Jan 23, 2013, at 4:28 PM, Pau Tallada wrote: 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: