News for hackers. Stuff that matters.
Re:You might not need an ORM by danwee on Wednesday January 25, 2023 @10:41AM (#34519541)
Post focuses on the "easy" part (building queries), but leaves as an exercise to the reader how to the the M in ORM: so, once I submit my SQL query and get one or more rows: how do I map them into my (potential) complex set of objects? Sure thing, I can do that manually (it's easy), but that's the whole point of using ORMs: to not to have to do it manually.

I also like the idea of using plain SQL and do all the additional manual work myself (that's what I do in personal projects): I like the feeling that I'm in control. When it comes to professional work, that's a recipe for disaster and ORMs bring consistency to the table.

Re:You might not need an ORM by thedanbob on Wednesday January 25, 2023 @10:49AM (#34519682)
That's one thing I like about Rail's ActiveRecord: it covers the most common queries with its own DSL, but also makes it easy to insert snippets of plain SQL while still returning ActiveRecord models.
Re:You might not need an ORM by jjice on Wednesday January 25, 2023 @10:49AM (#34519686)
The mapping part is definitely the part of an ORM I like the most. I like both (although unrelated from my understanding) sqlx for Go and sqlx for Rust, which both handle the mapping problem given raw SQL.
Re:You might not need an ORM by antipotoad on Wednesday January 25, 2023 @10:53AM (#34519765)
I’m inclined to agree. The article brushes over the type-safety provided by Prisma as being merely a ‘useful feature’ — but this is huge, especially working on a large project with lots of other developers. The discipline imposed by strict types is indispensable to my mind, how ever much I agree with the author that writing SQL directly feels good.