On Dec 18, 2007, at 9:49 AM, voltron wrote:

>
> I am trying to retrieve unique users from a table using this:
>
> results = sa_session.query(TempScore).group_by(TempScore.user_name)
>
> This unfortunately causes the error below:
>
> "There was a problem: (ProgrammingError) column "temp_scores.id" must
> appear in the GROUP BY clause or be used in an aggregate function"
>
> Could someone tell me what the SA 0.4 syntax would be for this query?
> I am using Postgresql
>
>

all columns that arent in an aggregate must be in the GROUP BY, so to  
get every column in, do this:

sess.query(TempScore).group_by([c for c in TempScore.c])



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