def test_apply_sum(self): """Query.apply_sum(col) avg = session.query(Address).apply_avg(Address.bounces) """ session = create_session() avgs = list(session.query(Address).values(func.sum(Address.bounces))) avg = avgs[0][0] assert avg == 11 avg = session.query(func.sum(Address.bounces)).one()[0] assert avg == 11
def test_aggregate_1(self): if (testing.against('mysql') and testing.db.dialect.dbapi.version_info[:4] == (1, 2, 1, 'gamma')): return query = create_session().query(func.sum(foo.c.bar)) assert query.filter(foo.c.bar<30).one() == (435,)
def test_aggregate_1(self): if (testing.against('mysql') and testing.db.dialect.dbapi.version_info[:4] == (1, 2, 1, 'gamma')): return query = create_session().query(func.sum(foo.c.bar)) assert query.filter(foo.c.bar < 30).one() == (435, )