def test_agg_filter(self): q = Query() q.select("total") q.select("store") q.agg("total") q.agg("total") q.where("total", "total > 50") q.tables("from here") self.assertEqual("SELECT"+q({})[6:], "SELECT store, total__into__ from here where total > 50")
def test_agg_filter(self): q = Query() q.select("total") q.select("store") q.agg("total") q.agg("total") q.where("total", "total > 50") q.tables("from here") self.assertEqual( "SELECT" + q({})[6:], "SELECT store, total__into__ from here where total > 50")
def test_where_aggs(self): "query: manages where aggs" q = Query() q.select("col", "sum", "total") q.select("store") q.agg("total") q.groupby("store") q.where("total", "total > 50") q.tables("from here") q.into(False) self.assertEqual(q({}), "with _data as (select sum(col) as total, store from here group by store) select store, total__into__ from _data where total > 50")
def test_where_aggs(self): "query: manages where aggs" q = Query() q.select("col", "sum", "total") q.select("store") q.agg("total") q.groupby("store") q.where("total", "total > 50") q.tables("from here") q.into(False) self.assertEqual( q({}), "with _data as (select sum(col) as total, store from here group by store) select store, total__into__ from _data where total > 50" )