5 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: How can I do join on...
FromSent OnAttachments
Jian Luo22 Aug 2007 08:37 
Michael Bayer22 Aug 2007 09:49 
Jian Luo22 Aug 2007 12:07 
Michael Bayer22 Aug 2007 13:38 
Jian Luo23 Aug 2007 01:08 
Subject:[sqlalchemy] Re: How can I do join on a self-referential m2m relation?
From:Jian Luo (jian@googlemail.com)
Date:08/23/2007 01:08:55 AM
List:com.googlegroups.sqlalchemy

I tried depth 4, with fine gain control using eagerload_all options. That works! Cool!

Thanks again for the great job!

Best

Jian

On Aug 22, 10:38 pm, Michael Bayer <mike@zzzcomputing.com> wrote:

Hi Jian -

yes, its the PropertyAliasedClauses. I put in a fix + a test based on your example in r3410. i didnt yet add a test for more levels deep yet, though, so see how that goes.

- mike

On Aug 22, 2007, at 3:07 PM, Jian Luo wrote:

class Widget(object): pass

mapper(Widget, widget, properties={ 'children': relation(Widget, secondary=widget_rel, primaryjoin=widget_rel.c.parent_id==widget.c.id, secondaryjoin=widget_rel.c.child_id==widget.c.id, lazy=False, join_depth=1, ) })

sess = scoped_session(sessionmaker())()

and I want eager load the widget whose id=1 and all it's children if any:

sess.query(Widget).filter(Widget.id==1).all()