Hacker News new | ask | show | jobs
by gmac 874 days ago
ORMs suck, but raw SQL embedded in your code sucks too.

This might be good time to plug my Postgres/TypeScript non-ORM: https://jawj.github.io/zapatos/.

I should say I also like what I've seen of https://kysely.dev/ and https://pgtyped.dev/.

3 comments

I've found embedding raw SQL into my code has been beneficial in two ways:

1. Hot reloading code. As a Java developer, this is important for prototyping as I can iterate quicker.

2. Clarity. I can read exactly what's going on and I know exactly what query is being executed.

Agreed, but tools like https://sqlc.dev, which I mention in the article, are a good trade-off that allows you to have verified, testable, SQL in your code.
> ORMs suck, but raw SQL embedded in your code sucks too.

_strongly_ disagree and I bet anyone who has this opinion can't articulate a good, concrete, reason for it. The best they're going to come up with is FUD about changing table names, which is one of those theoretical things that very rarely manifests itself in reality.