TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Give PonyORM a chance

51 pointsby kozlovskyalmost 11 years ago

13 comments

datashamanalmost 11 years ago
I do not really understand the desire for ORMs to try and recreate the experience of writing SQL. Why not just use SQL, then?<p>I understand that the ORM is trying to smooth over differences in implementation, providing the possibility of change from one DB access layer to another.<p>I have yet to see anyone do that on a real project, which makes me really wonder at the point of using an ORM at all.<p>I cannot quantify the amount of time I&#x27;ve lost figuring what the hell I must do to generate a relatively simple SQL statement.
评论 #7799741 未加载
评论 #7799641 未加载
评论 #7799665 未加载
stanaalmost 11 years ago
Surprised by number of negative comments about ORM-s. Twice I have had to migrate projects between different sql db engines. Once SQL was embedded in the application, second time perl-s DBIx ORM was used from the beginning. Guess which project was easier. Why would you lock yourself into using a specific db engine unless you really had to. And how hard is it to embed SQL for a few specific queries even when using ORM. Lately heavily using Django&#x27;s ORM and think it is great. And if your data structures so complex that ORM does not do the job maybe something wrong with your schema. I like my data layer simple if possible, and complexity in the application.
评论 #7799729 未加载
评论 #7799707 未加载
sgiftalmost 11 years ago
No chance. Sorry Pony, you are probably a great ORM, but I have been burned too often by ORMs and their &quot;magic&quot;, which will &quot;just work&quot; (hahahahahahaha). Hibernate destroyed my trust in ORMs forever and even SQLAlchemy (which is great) wasn&#x27;t able to fully restore it. I will write my queries alone. So that I know why they misbehave and I can change it instead of trying to chase through obscure layers of magic, read various loggings (if logging is available) and hope that my changes in the ORM layer will translate to the sql I want.
评论 #7799603 未加载
评论 #7799558 未加载
评论 #7799572 未加载
the_mitsuhikoalmost 11 years ago
Why you should not: it&#x27;s inferior to SQLAlchemy and has a dual licensing model where one is the useless AGPL and the other is an expensive commercial license.<p>Also I find it&#x27;s implementation to be very questionable.
评论 #7799686 未加载
评论 #7799633 未加载
coleiferalmost 11 years ago
I&#x27;m the author of a lightweight python ORM (peewee) and have a healthy respect for the work that goes into building this type of tool. PonyORM is quite a feat of software engineering: it&#x27;s developer(s) have done a great job.<p>I would never use it, though, because decompiling Python generator expressions just feels <i>so unpythonic</i>.
评论 #7800113 未加载
评论 #7799983 未加载
jstschalmost 11 years ago
I still feel that RedBeanPHP (<a href="http://redbeanphp.com" rel="nofollow">http:&#x2F;&#x2F;redbeanphp.com</a>) has found the right balance between direct object manipulation and SQL. I find that abstracting away SQL too much gives more headaches than it&#x27;s worth — SQL is a valuable skill anyway, and often diving into SQL is much faster and easier than diving into abstraction magic.
评论 #7799629 未加载
评论 #7799556 未加载
nnqalmost 11 years ago
&gt; It essentially decompiles the generator into its bytecode using the dis module, and then converts the bytecode into an AST.<p>Uhm, anyone knows what are the performance costs of this?
评论 #7799549 未加载
mtfordalmost 11 years ago
I do a lot of heavy Django work and first glance I really like the syntax. Much cleaner that what I&#x27;m used to. I will def give this a try at some point and comment further.<p>Why the name PonyORM btw? I know it&#x27;s superficial but I much prefer the name SQLAlchemy - has more meaning.
评论 #7799643 未加载
评论 #7799630 未加载
megaman821almost 11 years ago
As someone who has had to maintain other people&#x27;s code, please use an ORM. Usually the biggest thing to fix is a person didn&#x27;t select related rows and ends up doing hundreds of queries inside a for loop.<p>Now the hand-written SQL people leave in SQL injection possibilities. They build up complex queries with crazy string concatenation. They either have no or a shitty data mapping layer (I mean, I really enjoy having to look at the database to figure out what fields select * from articles returns).<p>Obviously there are going to be queries outside of what any normal ORM can do, but every ORM I have used gives you an escape hatch to just write raw SQL when needed.
makmanalpalmost 11 years ago
I&#x27;m just waiting for zzzeek to publish a blog post on how to implement this on top of sqlalchemy core, like this post [1]. :) Seriously though, sqlalchemy ORM layer already does this. Why not leverage all the existing features and support it has? Also, it&#x27;s an easier sell for a $100 piece of software: &quot;If you&#x27;re using sqlalchemy, you can migrate to pony immediately.&quot;<p>[1] <a href="http://techspot.zzzeek.org/2011/05/17/magic-a-new-orm/" rel="nofollow">http:&#x2F;&#x2F;techspot.zzzeek.org&#x2F;2011&#x2F;05&#x2F;17&#x2F;magic-a-new-orm&#x2F;</a>
评论 #7799826 未加载
GlennSalmost 11 years ago
The lack of data migration tooling would be a critical problem for me.<p>The traditional problem that ORMs are supposed to solve is change. Changing your database schema means you have to change all your queries. So instead you have a a system whereby the program that executes your queries also understands your schema and can make that change for you.<p>Data migrations are similar to this, only much harder and more time consuming.
mantrax5almost 11 years ago
I think once a developer reaches a certain level of experience and maturity, they realize they should stop giving any sort of ORM a chance.
评论 #7799575 未加载
hirrealmost 11 years ago
ORMs basically comes from &quot;lazy&quot; programmers not wanting to learn SQL and proper database schema design and wanting something &quot;that just works&quot; instantly with little thought effort... Optimizations and handling of large data sets are some of the problems with ORMs. However, in our case we decided to use an ORM anyways because each UPDATE&#x2F;DELETE&#x2F;INSERT had to be signaled out to some lowlevel code, communicating with hardware. If we hadn&#x27;t used an ORM (with overloaded save-methods) the user would have to keep track of all changes himself and signal the hardware manually, so in our case this was fine (we also didn&#x27;t manage large data volumes)...