Spyced : A point for ORM developers to remember
At the risk of proceeding to beat a dead horse, didn’t anyone look at those code samples and think, « wow, our ORM code is way the hell uglier than the vanilla SQL? »
Source: Spyced
I must confess I wrote my own ORM in Python. Twice. The second try is a bit better (using metaclasses and all), and you don’t have to jump through hoops to make SQL requests. But in the latest version, I did the stupid mistake of trying to build a request micro-language, using operator overloading (& and | like in Django).
Well, this is a bad idea. Indeed, invariably, what is easily written in SQL looks a tad uglier in Python, and what is not easily written in SQL cannot be written in Python. So my decision is made : I’ll revert all my « ooooh-I’m-so-cleverly-using-operator-overloading » request generator code and stick to writing SQL with a little bit of help from the ORM (because, you know, DBAPI 2.0 is somewhat dumb about query parameters).