Pony ORM
程序员必上的开发者服务平台 —— DevStore
Pony ORM 非常有趣.
Pony 可以将 Python Generators 翻译成 SQL.
它拥有可视编辑器和模型等其他特性.
Free for Non-commercial use with paid commercial licenses.
语法:
select(c for c in Customer if sum(c.orders.price) > 1000)
翻译成 SQL 后的效果:
SELECT "c"."id"FROM "Customer" "c" LEFT JOIN "Order" "order-1" ON "c"."id" = "order-1"."customer"GROUP BY "c"."id"HAVING coalesce(SUM("order-1"."total_price"), 0) > 1000