On Jun 13, 2013, at 11:03 AM, Ladislav Lenart <[email protected]> wrote:
> Unfortunately migrating to SA 0.9 is not an option for me at the moment due to
> severe time constraints.
I was pretty sure you'd say that, though I'm really looking to verify that my
fixes are going to hold up under real world usage. The issues you're having
are real issues, and they've been fixed.
>
> Could you please help me write SA query for 0.7.9 that uses index scan and
> also
> loads all the necessary relations? It must be possible with a proper use of
> from_statement(), contains_eager() and/or other SA features. It is just that
> toy
> examples in the documentation don't help me much with this complex beast.
you use the SQL expression language in conjunction with .join()/outerjoin(),
pass to query.select_from(), then use contains_eager():
j =
Foo.__table__.outerjoin(Bar.__table__.outerjoin(BarA.__table__).outerjoin(Data.__table__))
q = s.query(Foo).\
select_from(j).\
filter(Foo.id.in_([1, 2, 3])).\
options(
contains_eager(Foo.bar),
contains_eager(Foo.bar.of_type(BarA), BarA.data)
)
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.