Live data from Hacker News

Prisma – ORM for Node.js and TypeScript

prisma.io

51–60 of 260 posts

Re: Prisma – ORM for Node.js and TypeScript

#51
post #8
post #5

Earlier quoted context omitted.

I suggest to not add a layer. Stay close of the SQL request, you can simply have a function that will fulfill an access pattern. No need for ORM.

Yeah, I have no problem with minimum ORM (prepared statements type of thing) - That's why I am asking the question, Prisma seems a bit too much. Usually I just use simple ORM helpers (get by primary key for example) and anything complex is raw sql. What I am looking for is ideally something that helps with type saftey and seeds/migrations/schema creation.

https://jawj.github.io/zapatos/ (no built-in migration support, though)

Re: Prisma – ORM for Node.js and TypeScript

#52

I LOVE Prisma. I’ve used Django, SQLAlchemy, Sequelize, Knex, and TypeORM in the past. all had rough edges that continually frustrated me or didn’t provide the functionality i needed. Prisma is different. It’s absolutely got rough edges, but the extremely strong type safety makes Sequelize look like a joke. The query engine itself, written in rust, combines and optimizes queries inside every tick of the event loop so…

To be fair, Sequelize makes itself look like a joke. I normally wouldn't call out an individual library to shit on, because I understand that a lot of work has gone into it.

But I used it for years and it was always buggy. Sometimes options wouldn't work correctly because the authors liked to do that clever JavaScript thing where they write `foo = optional_thing || default_value` even for BOOLEAN options. I always had issues with it not being able to truncate/drop tables correctly that had foreign keys (it didn't attempt to order them intelligently), some of the options weren't compatible with each other even though they were orthogonal (I'm thinking about the snake_casing options and the created_at/updated_at column features), etc, etc.

It just... didn't actually work. Over many versions. I think I used it from late 3.x somewhere through 5.x.

Maybe it's awesome now, but I doubt it.

Re: Prisma – ORM for Node.js and TypeScript

#54

I have adopted Prisma in my latest project and I have mixed feelings about it. - The generated client is top-tier. Fully specified in TypeScript with intelligent types that can be extended by the user. - The schema language is great. It provides a cohesive experience that can fully express your database structure, and it also provides a migration framework to manage that structure's evolution. - There's no hook for i…

While depending on a live DB for testing isn't great, why not just blow away database state after every test by running TRUNCATE / DELETE against all tables? DELETE especially is very fast (couple ms) if you're not inserting large amounts of data during your test runs.

1) You can't run tests in parallel.

2) It is at least an order of magnitude slower than not using a database at all.

Combined this makes for very slow tests. Certainly for larger applications with thousands of tests.

Having said that, I don't think there is a single right answer to the problem of testing applications that use a database and your suggestion still can be a valid solution.

Re: Prisma – ORM for Node.js and TypeScript

#55

“ Application developers should care about data – not SQL” Anyone who has been bitten by an ORM generating inefficient SQL (and subsequent having to learn and care about SQL) knows the above not to be true.

The statement is true, IMO. The problem is that ORMs don't ever solve the problem (and I don't believe they CAN).

We should only have to care about data and not SQL. But the reality is that we very much do have to care about SQL.

Re: Prisma – ORM for Node.js and TypeScript

#58

I am a noob in these matters which one is advised if one is to start a GraphQL API from the beginning - use DBs that directly provide GraphQL endpoints such as Fauna, Upstash, etc. - use an ORM with more traditional DBs. What are the pros and cons of each?

I prefer having the database as a single source of truth and use something like [Hasura](https://nhost.io) to generate the GraphQL API.

Re: Prisma – ORM for Node.js and TypeScript

#59

I LOVE Prisma. I’ve used Django, SQLAlchemy, Sequelize, Knex, and TypeORM in the past. all had rough edges that continually frustrated me or didn’t provide the functionality i needed. Prisma is different. It’s absolutely got rough edges, but the extremely strong type safety makes Sequelize look like a joke. The query engine itself, written in rust, combines and optimizes queries inside every tick of the event loop so…

Laravel has Eloquent and it’s an absolute delight to use. I’ve used Rails and Django, and I always felt as if I was fighting the ORM, where as with Eloquent everything just seems natural.
Post reply on HN