News for hackers. Stuff that matters.
Re:OrmHate by jerf on Tuesday June 26, 2012 @11:16AM (#4162302)
"If I was to write the sql for this, I'd take 10x the time and it would be wrong anyway."

SQL is the problem here. It's so hard to write reusable, composable fragments of SQL that we've all just internalized the idea that we have to write the query you're referring to from scratch every time, which is a bizarre and annoying intrusion of 1970s software engineering into our 2012 world. You almost certainly have patterns of access you are using, and if you could define those in a more sensible query language, and easily compose them together later, basically DRY out your queries, you might not find this such a daunting prospect, and might not need to use an ORM to paper over this deficiency.

It's SQL that's the real, core problem here, and I mean the language qua query language, not the relational model, not object orientation, not even the impossible mapping thereto, it's that SQL is a terrible, terrible language. We should stop elevating it to the status of One True Query language. If SQL didn't suck so hard it wouldn't be so necessary to try to solve the impossible mapping problem in the first place.

Re:OrmHate by debacle on Tuesday June 26, 2012 @11:28AM (#4162390)
I would agree with you. It's impossible to write a query that can both be composable and also use all of the features of the SQL server's optimizer.
Re:OrmHate by jerf on Tuesday June 26, 2012 @12:34PM (#4162767)
I've done the "kick a design around in my head as I'm driving home" on this problem a few times, and the optimizer is always what ends up stopping me dead. I can create a new query language, I can write the compiler to turn it into an equivalent SQL query, but I have no interest in the monstrosity the language would become if it tried to give you enough control over the resulting SQL to satisfy optimizers. A query language that produces uselessly slow SQL is itself useless, so it's hard to get up the motivation to start a project like this when there's basically no way I can produce something usable.
Re:OrmHate by lucian1900 on Wednesday June 27, 2012 @05:21PM (#4169308)
I've found tools like SQLAlchemy do let you compose queries pretty well.

I've been told ClojureQL has a similar property.

Re:OrmHate by mping on Wednesday June 27, 2012 @05:06AM (#4166166)
Interesting remark. Although I really can't see any other good alternative at the moment.
Re:OrmHate by nollidge on Tuesday June 26, 2012 @11:49AM (#4162510)
I've often felt that SQL was terrible, but I don't know what would be better.
Re:OrmHate by jules on Tuesday June 26, 2012 @12:51PM (#4162870)
Relational algebra or Datalog.