Excellent thanks, I had looked at this before but not got it work.  The
following now works:
query.options(eagerload_all("parents"),eagerload_all("children")).all()

Cheers,
Andrew

On 5 February 2010 08:38, Gaetan de Menten <[email protected]> wrote:

> On Thu, Feb 4, 2010 at 17:25, Andrew <[email protected]> wrote:
>
> > I have a table of "tasks" which contain references to multiple
> > children and parents (tasks can have multiple children and multiple
> > parents in this example). These are defined as ManyToMany and so I get
> > an extra table containing the links.
> >
> > If I select all tasks, how can I then see a particular tasks children
> > without sqlalchemy making another query every time.
> > I have a case where I want to get a list of say 500 tasks and their
> > children but end up with 500 extra queries.
>
> Search for "eagerloading"/lazy=False in the documentation. You can
> configure it either on the relation, or on the query.
>
> HTH,
> --
> Gaƫtan de Menten
> http://openhex.org
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<sqlalchemy%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
>
>

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

Reply via email to