8 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: Custom comparator wi...
FromSent OnAttachments
Martin Pengelly-Phillips27 May 2008 11:24.py
Michael Bayer27 May 2008 11:33 
Martin Pengelly-Phillips27 May 2008 12:11 
Michael Bayer27 May 2008 13:08 
Martin Pengelly-Phillips27 May 2008 14:02 
Martin Pengelly-Phillips28 May 2008 03:12 
Michael Bayer28 May 2008 07:32 
Martin Pengelly-Phillips28 May 2008 07:58 
Subject:[sqlalchemy] Re: Custom comparator with in_ (and subqueries)
From:Martin Pengelly-Phillips (mart@googlemail.com)
Date:05/27/2008 02:02:34 PM
List:com.googlegroups.sqlalchemy

That makes sense - thanks again.

Martin

On May 27, 9:09 pm, Michael Bayer <mike@zzzcomputing.com> wrote:

On May 27, 2008, at 3:11 PM, Martin Pengelly-Phillips wrote:

Hi Michael,

Thank you for the quick response. I had thought about using a straightforward OR statement - are you suggesting that this would form the body of the in_() method on the Comparator or were you referring more to just compiling the OR statements in the base query?

i was saying the result of in_() would be a construct like:

or_(*[col1.in_([x,y,z]), col2.in_([d, e, f]), ...])

Also, what is the correct expression for defining a subquery with the ORM interface (I gather my embedded session.query statement currently evaluates as a separate statement to return the list of candidates).

any select() constituites a subquery when placed wihtin an enclosing select(). Often its a good idea to further enclose it in an Alias construct by saying select().alias(). Read through the SQL expression tutorial for examples.

the subquery() method on Query wouldn't be used inside of a Comparator since theres no Query object available in those methods and its an overly heavy-handed approach at that level.