Re:Pony ORM - Use Pure Python to Speak to Your Data
by kijin on Friday April 19, 2013 @07:52AM
(#5576082)
Here's an example from the documentation that just reads like a "rough translation of SQL into Python":
select((item.order, item.order.total_price,
sum(item.price * item.quantity))
for item in OrderItem
if item.order.total_price < sum(item.price * item.quantity))
> you're still littering Python with SQL keywords like order_by(), desc(), select(), and commit()
Well, I see them not as “SQL keywords” but as logical concepts
> The GROUP BY section of the documentation just reads like a rough translation of SQL into Python
Hmm, not sure I understand this. With PonyORM, GROUP BY section is generated automatically, and not present in Pony ORM queries. This eliminates the need to duplicate the same columns in SELECT and GROUP BY sections.
> Beyond a certain level of complexity, you need to know SQL in order to write complex queries.
I agree with this. But I hope PonyORM can lower entry barrier for new developers. Also, PonyORM allows developers to use pure SQL, if all they need from mapper is IdentityMap, caching, etc.
> By the way, why is there an order_by() method and a separate orderby() method?
Thanks for noticing this, it is a typo in documentation. The method was renamed from orderby() to order_by() recently.