def promotion_history(cls, count_column, codename, start, stop):
 time_points = get_time_points('hour', start, stop)
 q = Session.query(cls.date, sum(count_column)).filter((cls.interval == 'hour')).filter((cls.codename == codename)).filter(cls.date.in_(time_points)).group_by(cls.date).order_by(cls.date)
 return [(r[0], (r[1],)) for r in q.all()]

def promotion_history ( cls , count_column , codename , start , stop ) : time_points = get_time_points ( 'hour' , start , stop ) q = Session . query ( cls . date , sum ( count_column ) ) . filter ( ( cls . interval == 'hour' ) ) . filter ( ( cls . codename == codename ) ) . filter ( cls . date . in_ ( time_points ) ) . group_by ( cls . date ) . order_by ( cls . date ) return [ ( r [ 0 ] , ( r [ 1 ] , ) ) for r in q . all ( ) ]
get hourly traffic for a self-serve promotion .