6 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: How to join against ...
FromSent OnAttachments
Bobby Impollonia26 May 2008 15:31 
Michael Bayer26 May 2008 16:15 
Bobby Impollonia26 May 2008 17:01 
Michael Bayer26 May 2008 21:02 
Michael Bayer26 May 2008 21:26 
Bobby Impollonia27 May 2008 09:49 
Subject:[sqlalchemy] Re: How to join against multiple tables at once?
From:Bobby Impollonia (bob@gmail.com)
Date:05/27/2008 09:49:30 AM
List:com.googlegroups.sqlalchemy

Add another item #3 to just the "good" group, the outer join method you're using will return a group id for that one as well, which your "null" check will filter out.

That was actually an error in my description. I meant to say that I am looking for things that are not in a Good group (rather than things that are not in a Bad group, which is what I actually said). That's why I was joining against Good groups and looking for things whose group id is null. So, the original query would be correct to filter out item #3 here.

Anyway, I hadn't known about this Not Exists technique. I changed my queries around to use that and it is actually faster than before and my SQLA code is a lot clearer using not_() and .any() than it was with chained joins and select_from, so this is a great solution. This is very helpful for me because I have run into variations of this in the past and never been sure how to build the best query. Thanks!