Live data from Hacker News

Prisma 2.0 – Type-safe and auto-generated database client

prisma.io

71–80 of 112 posts

Re: Prisma 2.0 – Type-safe and auto-generated database client

#71
post #43

I have a lot of experience with ORMs (the Django one in particular). I'm having a hard time finding a quick overview of how Prisma's model is different. Are there any good overviews of the similarities and differences?

Daniel from the Prisma team here. Both Prisma and ORMs abstract away from SQL and let you "think in objects". However, how they do that is different. With ORMs, you typically map tables to model classes With Prisma, the focus is on queries and structural typing; queries return plain objects that are fully typed based on the query. For a broader comparison with ORMs, check out the documentation page about why Prisma i…

Cool, thank you very much!

Re: Prisma 2.0 – Type-safe and auto-generated database client

#72

I empathize with the frustration that this library is trying to solve. It's pretty nifty too! Ultimately, however, I don't believe this is the correct approach. The problem with this tool, like every other multi-SQL-flavor-SQL ORM and query builder, is that it requires users to learn yet another language. In addition to Node.js and SQL, users need to learn the Prisma query language. This is not trival, and users that…

"I think the best approach to this problem is a single-SQL-flavor query builder that attempts to match SQL as closely as possibly while adding in the niceties of being able to pass in JavaScript objects instead of raw SQL strings. Lets be honest: raw SQL-in-JS is no fun."

You essentially describe Elixir's Ecto, which has been lovely to work with. You may want to check it out.

Re: Prisma 2.0 – Type-safe and auto-generated database client

#73
I'm really excited about Prisma and how it's contributing to the Node.js ecosystem. Two new full-stack frameworks, Redwood and Blitz, are based on it, and it's prominently mentioned in their READMEs. https://github.com/redwoodjs/redwood https://github.com/blitz-js/blitz

As a status announcement, this isn't quite as exciting as it sounds because migrations are still "experimental". Still great to see!

Re: Prisma 2.0 – Type-safe and auto-generated database client

#74

Prisma's architecture seems novel and ... a little strange to me. It works by running a Rust engine as a subprocess and then communicating with the engine from JS land over a non-spec compliant GraphQL API. The engine holds the actual databae connection pool and does all the SQL generation and data marshalling. See https://www.prisma.io/docs/reference/tools-and-interfaces/pr... for more info on this arrangement. It h…

I generate Typescript types from my database ([link redacted]) which gives me type safety on back- and frontend without relying on an ORM. I am curious about Prisma but I don't see any advantage to it from my quick skimming.

Re: Prisma 2.0 – Type-safe and auto-generated database client

#76

Not sure I 100% agree with their problem statement. > the problem: Working with databases is difficult Working with databases is a relatively solved problem. You can access them from just about any language on any platform. A more accurate statement would be: choosing the right access method to work with databases is difficult.

Well said. Though Hasura makes it easier.

Re: Prisma 2.0 – Type-safe and auto-generated database client

#77

Prisma's architecture seems novel and ... a little strange to me. It works by running a Rust engine as a subprocess and then communicating with the engine from JS land over a non-spec compliant GraphQL API. The engine holds the actual databae connection pool and does all the SQL generation and data marshalling. See https://www.prisma.io/docs/reference/tools-and-interfaces/pr... for more info on this arrangement. It h…

I generate Typescript types from my database ([link redacted]) which gives me type safety on back- and frontend without relying on an ORM. I am curious about Prisma but I don't see any advantage to it from my quick skimming.

What do you use to write the queries? Some query builder?

Re: Prisma 2.0 – Type-safe and auto-generated database client

#79
post #4

I don't have my head in backend too much these days and haven't kept up with all of these solutions. It seems like Hasura is the more popular option right now? or do they fit a slightly different space?

Having used both, I would pick Hasura for any project going forward. Time to productivity is so much faster with Hasura and “it just works”. Prisma, at least when I was using it, was introducing breaking changes regularly and whipsawing between major design choices.

This has been my experience as well. Then Prisma wasn't able to correctly "introspect" the database, threw a generic error, and that was the end.

Re: Prisma 2.0 – Type-safe and auto-generated database client

#80

Earlier quoted context omitted.

Prisma and Hasura are very different! Prisma is a database toolkit that's used by application developers to develop server-side applications in Node.js and TypeScript (e.g. REST APIs, microservices, gRPC calls, GraphQL APIs, ..., anything that talks to a database). The main tool Prisma Client is a query builder that's used to programmatically send queries to a database from Node.js/TS. Hasura is a "GraphQL-as-a-Servi…

> That setup can be great when your application doesn’t require a lot of business logic and the CRUD capabilities that are exposed in the GraphQL API fit your needs (though I believe you can add business logic in Hasura by integrating serverless functions). (I’m from Hasura) You can extend business logic in Hasura in a number of ways, including (but not exclusively) ones that work well with serverless and async archi…

What do you think of Hasura vs Postgraphile?

https://www.graphile.org/postgraphile/

Post reply on HN