mg wrote:
>
> Hi,
> I have a query object that looks like this:
> stmt = session.query(
> extract('hour', History.click_ts).label('hour'), func.count
> ('*').label('value')
> ).filter(History.click_ts >= func.now() - func.interval('24 hours'))
>
> i'd like to be able to do the following:
> stmt.group_by(hour), but I'm not seeing a way to group by the label
> that i've created in the stmt object.
>
> Any suggestions?
>
> btw, this is the sql query I'm trying to convert into a sa statement:
> select count(*) as value, EXTRACT(hour from click_ts) AS hour
> from history_clicks
> where click_ts >= now() - interval '24 hours'
> group by hour
group_by("hour")
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---