▲ | kaoD 3 days ago | ||||||||||||||||
Query builders are still an antipattern (what we traditionally think of when we say query builders) because they are still a DSL that (1) you have to learn along with SQL and (2) never map cleanly to actual SQL, so you always have to resort to `.raw` calls when you need anything more complex than a simple SELECT+JOIN. Even for simple SELECTs, I lost count of how many times I had to enable runtime DEBUG logging in my query builders to get a query that I can copy-paste into my DB client for debugging, data exploring, etc. I should be able to copy-paste my query from code and run it in `psql` with minimal changes. Raw SQL is the way to go[0]. Period. You just need a thin wrapper on top of it that adds escaping, arguments, type-safety and other QoL. [0] https://gajus.medium.com/stop-using-knex-js-and-earn-30-bf41... | |||||||||||||||||
▲ | esafak 3 days ago | parent | next [-] | ||||||||||||||||
That thin wrapper is a query builder. | |||||||||||||||||
| |||||||||||||||||
▲ | monkeyelite 2 days ago | parent | prev [-] | ||||||||||||||||
I'm with you. |