Conor wrote:
>
> On Sep 1, 12:13 pm, "Michael Bayer" <mike...@zzzcomputing.com> wrote:
>> [...]
>> have you considered the advice
>> athttp://www.sqlalchemy.org/docs/05/mappers.html#building-query-enabled...
>> ?    an embedded EXISTS subquery in a relation() doesn't seem like
>> something that should be emitted implicitly - hand-constructing the
>> appropriate Query on a case by case basis would lead to better results.
>>
>
> Thanks for your reply Michael.
>
> I wanted it to be a relation so that I would only have to define it
> once and be able use it in different contexts, but it is not
> absolutely urgent.
>
> Also, I did try writing the query without using raw SQL, but I could
> not get the relations' any() calls to correlate properly. The query I
> tried, along with the generated SQL, is at
> http://python.pastebin.com/f5ec43ac9.
> The highlighted lines show that var_clause and run_item, respectively,
> are not getting correlated to the outer queries. Is there a way to
> make the any() method force this correlation?

any() is hardwired to correlate only to the parent table of the
relation().  So for anything more custom than that you'd probably have to
spell out the correlation you want using exists().correlate(<tables>).

if you're super-motivated to build up these comparators (personally I
wouldn't be), you can build it up using comparable_property() and your own
PropComparator subclass.


> >
>


--~--~---------~--~----~------------~-------~--~----~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to