News for hackers. Stuff that matters.
Re:Prisma – ORM for Node.js and TypeScript by notJim on Wednesday April 21, 2021 @02:13PM (#26893377)
> We've recently switched from JavaScript based querying code to mostly raw SQL

Curious what your use case is, because in every codebase I've worked on, people pretty quickly get tired of writing out SELECT * FROM [table] WHERE id=? and UPDATE [table] SET field=? and looping over database cursors all day, and you end up with a half-done, buggy non-ORM.

Re:Prisma – ORM for Node.js and TypeScript by nicoburns on Wednesday April 21, 2021 @06:24PM (#26896205)
We're using knex.js, so we're not messing around with database cursors (we get an array of objects), and we don't have to write out the columns for inserts/updates. We also sometimes use the knex query builder for super trivial selects from a single table.

But for anything more complex than that (e.g. SELECT queries joining several tables) we're using knex.raw so the query itself is raw SQL where we're very much thinking in the relational model rather than in terms of objects.

Re:Prisma – ORM for Node.js and TypeScript by notJim on Wednesday April 21, 2021 @06:46PM (#26896372)
Ahh that makes more sense. My preference has been to use an ORM for your normal CRUD, but write more advanced queries using SQL (or sometimes just write the where clause using SQL, if the select is otherwise simple.) I am not a fan of query builders.