On Monday 08 December 2008 23:39:57 Michael Bayer wrote:
> On Dec 8, 2008, at 3:49 PM, [EMAIL PROTECTED] wrote:
> > hi
> > back to that old question about relation vs query,
> > i have some relation, say m2m via table with some additional
> > fields like timestamps (which are setup automaticaly).
> > so plain relation via secondary join is ok, no really need for
> > explicit assoc_object.
> >
> > by default, the relation will give me all items, regardless of
> > timing. now, i want to filter by times. it will be done by some
> > function, which will have the timing context and ... what?
> > the easiest answer is python-filtering: [x for x in the_relation
> > if x.fits.filter ] but that would be very expensive. i dont want
> > that relation loaded in full, it's meaningless.
> > so, is it possible easy to obtain the query which the relation
> > will issue, so i additionaly put .filter() on it and issue it
> > myself? no changes to original relation.
>
> sure...
> query
> (A).join(A.bs).filter(B.whatever=='foo').options(contains_eager(A.b
>s))
>
> or if you want the B's by themselves given an "a"
>
> query(B).with_parent(some_a, "bs").filter(B.whatever=='foo')

good, thanks.
it smells to me like i need the relation/PropertyLoader but not the 
instrumented collection over it - or quite different one. lets see...

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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