News for hackers. Stuff that matters.
Re:Don't use your ORM entities for everything – embrace the SQL by mannyv on Friday March 29, 2024 @12:41PM (#39866093)
I still don't understand why people believe that abstracting away something as important as your data store is a good idea. They quickly run into performance problems that are quite difficult to fix.

It's funny that the same developers that try to avoid vendor lock-in don't realize they've locked themselves into an ORM forever.

Plus, SQL isn't that hard. And as a backend person, you should be able to visualize your data model anyway. A SQL datatbase is just a bunch of planes, for the most part, and the queries are how you intersect them...more or less.

Re:Don't use your ORM entities for everything – embrace the SQL by internetter on Friday March 29, 2024 @12:43PM (#39866124)
We use Kysely[0], which is a nice balance. The code you write in Kysely translates 1:1 into SQL, which means there's very little perf left on the table, but we get an interface that's automatically typed, type safe, and works well with our js language tools.

[0]: https://kysely.dev/

Re:Don't use your ORM entities for everything – embrace the SQL by clarkdave on Friday March 29, 2024 @01:12PM (#39866485)
Kysely is excellent! Another library that complements it is pgTyped[0]. It compiles .sql files into functions with strongly typed parameters and return values

[0] https://pgtyped.dev/