Live data from Hacker News

What ORMs have taught me: just learn SQL (2014)

woz.posthaven.com

1–10 of 360 posts

Re: What ORMs have taught me: just learn SQL (2014)

#5
A lot of the reasons listed in this article actually made me shift from sophisticated ORMs like Hibernate back to a query based approach. A really nice framework for this (in Java) is jOOQ which gives you the possibility to write typesafe SQL via code generation. https://www.jooq.org/

(I'm not at all affiliated with jOOQ - just a happy user)

Re: What ORMs have taught me: just learn SQL (2014)

#7
I have to agree. ORMs can be great when an application is just starting, because that's when you're writing the most tedious queries and statements, but beyond that I personally find that ORMs just get in the way.

As soon as I need to write something more complicated than select-by-id I end up reaching straight for SQL. Otherwise I have to learn both the ORM's query API or DSL and have the proper mental model for how it translates to actual SQL.

Or I could just write SQL and be done with it. No mysteries.

Maybe this is just me, but I've never written a join in an ORM that I had the slightest bit of confidence in.

Re: What ORMs have taught me: just learn SQL (2014)

#8
He says he likes SQLAlchemy, but doesn't say why. I'm interested to know that though.

To me, the big win with SQLAlchemy is that it separates the SQL expression layer from the ORM layer so cleanly. I can write very complicated queries with the expression layer that wouldn't be possible at the ORM layer, and do it in a much more composable way than concatenating SQL strings. Example: http://btubbs.com/postgres-search-with-facets-and-location-a...

Post reply on HN