Remix.run Logo
stavros 4 days ago

> Also, don’t use an ORM. Just write that SQL. Your future self will be thankful.

I have never understood this. I've been using the ORM for twenty years now, it's saved me countless hours, and I've very rarely needed to break out of it. When I did, I just wrote an SQL query, and that was it. What's the big deal?

sceptic123 4 days ago | parent | next [-]

This depends very much on the size of the code base, the amount of data in the DB and (of course) the quality of the ORM.

It sounds like you are lucky enough that you have never had an ORM generating badly optimised/n+1/over-eager queries that take down a production service. Or perhaps had to debug low level query cache issues causing unexpected problems.

I'm not advocating for plain SQL, just offering some suggestions as to why someone might want you to consider it.

alabastervlog 4 days ago | parent | prev [-]

It depends on the ORM. I've definitely seen a couple (popular, even) where it's worse than nothing at all, if you're comfortable in SQL. But most of them I'd agree, they're handy.

I think some of the blanket "just don't" comes from people who've had to onboard to projects written by teams that didn't understand SQL, but did (sort of) know how to use an ORM, and blame the ORM for allowing those teams to commit their atrocities. But that doesn't make an ORM a bad thing in capable hands.

stavros 4 days ago | parent [-]

Ah yeah, my experience is with the Django ORM, with which I've had nothing but good experiences with.