3 ms·
> working with databases in Node.js and TypeScript has always been a painful experience Even after reading your (three) paragraphs from the article on why raw
by pphysch 6y ago
> working with databases in Node.js and TypeScript has always been a painful experience
Even after reading your (three) paragraphs from the article on why raw SQL and drivers are bad, I'm far from sold.
1. Establish connection
2. Execute SQL
3. Manipulate results
4. More SQL/Commit/close
IME a lot of the struggle comes from not understanding how 1. or 2. work and trying to do all the heavy lifting in 3. The amount of times I've refactored dozens of lines of code into <10, with huge performance and readability gains by simply using SQL's potential...
Best of luck with the sales.
- dllthomas 6y agoOn the other hand, working at a large company I saw a many-line SQL query that had been run monthly for a long while, looked at and edited by quite a few people, which down in the middle of it was comparing (for equality) a city id and a probability. There is absolutely room for improved tooling. I have no idea whether Prisma is it.
- infinite8s 6y agoWell better tools wouldn't have helped that, since most of the them just expose the underlying low-level DB types. Until databases support a proper type-system that doesn't just describe memory layout that kind of bug will always be an issue.
- dllthomas 6y ago"A proper type-system that doesn't just describe memory layout" is one kind of better tool, whether built into the database or separate.