Live data from Hacker News

Prisma – ORM for Node.js and TypeScript

prisma.io

241–250 of 260 posts

Re: Prisma – ORM for Node.js and TypeScript

#242
post #209

Earlier quoted context omitted.

I use Hasura and generally like it, it certainly has some sharp edges, but overall has worked. I think Hasura has much richer GraphQL support, which I pair with gqless[0] to get what I think is a much nicer client side / ORM experience overall. Other upsides are a much better RBAC column/row permissions, migrations with up/down, a better admin UI. [0] https://gqless.com

What sharp edges are you referring to? I find that with new tech, I'm more interested in what it can't do rather than what it can.

Hard to remember them all now, but definitely had a number of bugs I've ran into, most able to be worked around. For example a recent one was a huge slowdown in a simple query that should be optimized[0], still have no great solution for it or attached to any roadmap.

One big one is at some point you need caching on a query level, and for that you have to purchase enterprise. I suppose they need to make money somehow, and it's a smart level to do it because it's almost impossible to not need caching at some fairly early stage. It would be nice if they let you test it out without "Contact Sales", and while there may be some way to wrap it from above, I don't think it's very easy.

A meta critique would be the project seems to have less momentum than Prisma. Releases aren't as frequent or large, and I'd have much preferred they double down on PG and keep adding query abilities, performance, etc, instead of expanding database engines.

[0] https://github.com/hasura/graphql-engine/issues/5745

Re: Prisma – ORM for Node.js and TypeScript

#243
I've been hunting for the perfect solution to reduce the boilerplate in the "database-backend-frondent stack" for years and came to the conclusion:

There is no shortcut. And we don't need one.

For most non trivial applications - when I used an ORM or other abstractions over SQL - there came the point at which I needed to dive quite deep into the workings of the ORM. However, learning how your DB and SQL works is much better spend time than learning the complexities of an ORM.

Equally important: The time saved upfront diminishes over the lifecycle of the project. Often (not always) figuring stuff out about the abstraction costs much more time and energy than writing the boilerplate. Typing out the boilerplate is boring, that's why we hate it so much. Figuring something new out? Time flies ...

For my projects I've got a template for basic CRUD operations including a frontend store. Full control, easy to use and understand and only a couple of minutes to fill in the field names for a new database table or view.

Re: Prisma – ORM for Node.js and TypeScript

#244
post #25

Earlier quoted context omitted.

> GraphQL N+1 issues are a thing of the past. Huh, care to explain this one? I’m using Prisma with Apollo Server without doing anything fancy in my resolvers. I just assumed I’m getting N+1 issues but didn’t bother to optimize yet.

in short the separate engine process allows them to combine every findX call you make during one tick of the event loop into a single SQL query, following the dataloader pattern, so you don’t have to implement it yourself. i’m sure @nikolasburk can shed some more light if you’re interested.

This isn't true. Prisma currently only supports batching of findUnique queries: https://www.prisma.io/docs/guides/performance-and-optimizati...

There's an issue open for findMany as well, but it hasn't moved in over a year: https://github.com/prisma/prisma/issues/1477

Re: Prisma – ORM for Node.js and TypeScript

#245
ORMs can be a pain. Setting up SQL schemas and managing migrations is also slow and tedious. Prisma won me over when my friend integrated it while we were working on SpaceTraders.io - things have mostly been going well. Main issue was not getting the transaction support needed for read / compute / write locks. Solved our needs for today with Redis, but we came very close to regretting the Prisma choice. Other than that the DX is amazing and the tooling is great. I think there is a lot of promise and I'm excited as they develop more advanced DB escape hatches.

Re: Prisma – ORM for Node.js and TypeScript

#246
post #209

Earlier quoted context omitted.

What sharp edges are you referring to? I find that with new tech, I'm more interested in what it can't do rather than what it can.

Hard to remember them all now, but definitely had a number of bugs I've ran into, most able to be worked around. For example a recent one was a huge slowdown in a simple query that should be optimized[0], still have no great solution for it or attached to any roadmap. One big one is at some point you need caching on a query level, and for that you have to purchase enterprise. I suppose they need to make money somehow…

Yikes!

That sounds like it has "vendor lock-in" written all over it.

Re: Prisma – ORM for Node.js and TypeScript

#247
post #211

Past related threads: Prisma Raises $12M Series A - https://news.ycombinator.com/item?id=23651605 - June 2020 (111 comments) Prisma 2.0 – Type-safe and auto-generated database client - https://news.ycombinator.com/item?id=23466834 - June 2020 (107 comments) Prisma 2.0 Beta: Type-safe Database Access - https://news.ycombinator.com/item?id=22739121 - March 2020 (122 comments) Comparing Database Types - https://news.yco…

Nice, thank you for digging these up!

Re: Prisma – ORM for Node.js and TypeScript

#248
post #237

Earlier quoted context omitted.

currently staring at what's left in a large legacy rails/activerecord app figuring out what to do with. the suffering is real.

What obstacles are you hitting?

the active record pattern, as it is commonly used, does not set you up well to lift individual components out of a monolith.

Re: Prisma – ORM for Node.js and TypeScript

#249
post #72
post #61

Earlier quoted context omitted.

Could you test this and get back to us with the results?

There are pretty extensive docs on how Prisma optimises n+1 queries: https://www.prisma.io/docs/guides/performance-and-optimizati...

The examples are still for a trivial case of joining one thing to many things. What about joining one thing to many things that join to many things that join to one thing that joins to many things that join to many things that join to many things?

Re: Prisma – ORM for Node.js and TypeScript

#250

Earlier quoted context omitted.

Interesting -- I actually haven't had as many problems as you have with TypeORM -- it's just mostly worked. Then again, maybe I'm a rare case, because I basically ignore the ORM side and use a little repository pattern, the query builder, and write my own migrations in SQL (as in all the migrations are `await queryRunner.query(...);`). It's been excellent for me -- I ignore the bad abstractions, have a good underlyin…

Yeah my issues are from trying to actually use the advertised functionality of the library. Issues include migrations being generated incorrectly, lots of footguns (for example it’s extraordinarily easy to instead of deleting a particular row, to delete your whole table, and their typescript typings are too general to make it clear what you’re doing), the pattern of making instances of relations that lack all the fie…

Thanks for sharing this insight, it makes a lot more sense to me now, saving this (in my brain) for the counter argument to TypeORM.

> I’m just scratching the surface, it’s telling that there are 1500+ unresolved issues on the repo and 200+ unmerged PRs.

So just a side note on this, I judge repositories based on teh ratio of closed to unresolved (and whether they have a bot that auto-closes issues). 200+ unmerged PRs is bad -- that maintainer needs help. I've interacted with the main maintainer before a long time ago and I had a good impression, but they probably weren't ready for how big their project got (how can anyone be) and they clearly didn't charge enough to make it a joy to work on their project. Money isn't the main motivator for everyone, but it would enable hiring people, or taking vacations as appropriate, etc.

Post reply on HN