On Nov 10, 2008, at 5:35 AM, Ian Charnas wrote:
> > Hello Alchemy Land! > > If I have a simple test-case with Bowler objects and City objects, and > I want to use func.max and group_by in order to find the highest > scorers in each city... I might do something like this: > > max_score = func.max(Bowler.highscore).label('highest_score') > results = session.query(Bowler, > max_score).group_by(Bowler.city_id).all() > > So this works as I'd expect, and 'results' now contains > (Bowler,max_score) tuples... but what I really want is to have a > query that just returns Bowler objects, and not these tuples. Is > there a way to get rid of that 'max_score' column from the result > set? I've been at this for hours, I bet it's really simple but I just > can't find it. hey Ian - any chance you can just use the func.max() at the end of the Query using the values() method ? that way its just an ad-hoc thing. Otherwise there's no official way to "remove" an entity from an existing Query's list of entities. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---