select(c for c in Customer if sum(c.orders.total_price) > 1000)
Along with https://pypi.org/project/pony-stubs/, you get decent static typing as well. It's really quite something.