Hacker News new | ask | show | jobs
by droobles 1190 days ago
What do you think of "micro ORMs" like knex.js, or Dapper for C#? I personally agree with you and my personal projects just use stored procedures, but these micro orms have always piqued my interest since they're just a SQL abstraction for building single queries.
3 comments

I would consider those "query builders" rather than fully fledged ORMs.
Yeah no. A micro ORM still expects you to write the full, raw SQL.

The raison d'etre for a micro ORM is to capture the results of that SQL query into a simple, flat collection of objects in a way that has a better UX than your framework's default behavior.

Micro ORMs are the perfect middle ground for debates like these.

I personally like those. They are qualitatively different from ORMs. They give you three things:

- sensible ways of composing queries beyond direct string concatenation

- safe parametrization

- return results into usable data structures (not objects)

None of these things carry the problems of ORMs. They don’t impose a paradigm that isn’t SQL. They simply let you interface with SQL in an ergonomic manner.

This is typically as far as I go with an ORM, CRUD operations on single tables that give you some type safety at compile time. If you need more complex data shapes I usually create a view or occasional stored procedure but that's about it. I use Entity Framework in my day job and do like the migrations though...