Live data from Hacker News

Prisma – ORM for Node.js and TypeScript

prisma.io

81–90 of 260 posts

Re: Prisma – ORM for Node.js and TypeScript

#81
post #59

Earlier quoted context omitted.

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.

I am a former PHP developer, absolutely loved Laravel and adored Eloquent as the ideal ORM. I switched to Node/JavaScript in 2015 and have been chasing a good ORM since, nothing could ever compare with Eloquent in Nodeland, I all but gave up and started building my own, in TypeScript to match Eloquent as much as possible. Then Nikolas Burk reached out to me and did his absolute best to convert me, but I was stuck in…

:heart:

Re: Prisma – ORM for Node.js and TypeScript

#82

“ 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.

This statement is certainly provocative (great that it was the first thing picked up here :D) but I'm happy to explain our rationale for this a bit more. SQL is an impressive technology and has stood the test of time! Yet, we claim that it's not the best tool for application developers who are paid to implement value-adding features for their organizations. SQL is complex, it's easy to shoot yourself in the foot with…

> Yet, we claim that it's not the best tool for application developers who are paid to implement value-adding features for their organizations.

You have two options when marrying RDBMS SQL and OO: either mismanage the relational data so that developers can use a class hierarchy, or stop using a class hierarchy to represent data.

IME, applications come and go. They get rewritten, thrown away, obsoleted. The database, however, is there to stay. Mismanaging the data purely so that the application developers don't have to touch all that icky relational stuff almost always results in more work for less returns.

Re: Prisma – ORM for Node.js and TypeScript

#84

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…

Having used in the past both Django and Rails ORMs, I totally agree with this. Prisma is awesome, it's been the best experience I've ever had so far with SQL databases.

Re: Prisma – ORM for Node.js and TypeScript

#85
post #63

Earlier quoted context omitted.

This statement is certainly provocative (great that it was the first thing picked up here :D) but I'm happy to explain our rationale for this a bit more. SQL is an impressive technology and has stood the test of time! Yet, we claim that it's not the best tool for application developers who are paid to implement value-adding features for their organizations. SQL is complex, it's easy to shoot yourself in the foot with…

I think SQL gets a lot of undeserved praise that I’m having a difficult time understanding. The only impressive thing about SQL is its prevalence but that’s a pretty poor yardstick unless one thinks that an appeal to popularity is an indicator of quality. Now let me count the ways in which SQL is bad: - it composes poorly due to its unwieldy cobolesque syntax - it is a leaky abstraction revealing a lot of underlying…

What are you comparing it to? What is the better alternative?

Re: Prisma – ORM for Node.js and TypeScript

#87
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.

I have been using Flyway with Node.js. Works all right and you write everything (migrations, schema, seeds) in SQL. It does make working with SQL quite straightforward and non-magical.

The thing is of course that with very complex queries you'll end up making quite intricate string building stuff which may not be very pretty. I myself am curious to find out if Prisma can make that part go away.

Re: Prisma – ORM for Node.js and TypeScript

#88
IMO any discussion about Node/TypeScript data access tools deserves a reference to Zapatos, which sort of is the anti-Prisma. It has all the type safety with none of the ORM (and it's Postgres-specific, for better and worse). I think it's got one of the best designed APIs I've come across.

https://jawj.github.io/zapatos/

Re: Prisma – ORM for Node.js and TypeScript

#89

I'm not a fan of ORM, never been and never will be. https://en.wikipedia.org/wiki/Object%E2%80%93relational_impe... But my gosh "Application developers should care about data – not SQL"

That line triggered me as well. I have built hundreds of applications on top of databases w/ sql and nosql, and from that experience— the notion that a single ORM abstraction somehow ameliorates the burden of caring about how your queries are written is alarming to me.

Re: Prisma – ORM for Node.js and TypeScript

#90
post #2

I'm just about to start working on DB layer for our app with TypeScript. Any other alternatives to prisma you guys prefer and why?

I love knex and simply write small functions and roughly keep one file/folder per table. So: user.create(db, { name: .. })
Post reply on HN