Live data from Hacker News

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

prisma.io

31–40 of 112 posts

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

#31
post #17

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…

Specifically in Node.js, https://github.com/gajus/slonik has drastically improved the experience of writing and composing SQL queries. I am the author of Slonik.

We use slonik and absolutely love it. Alongside polymode (for inline sql mode) in emacs it’s wonderful to use. Thank you for writing and maintaining such a great library.

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

#32

I'm super excited about Prisma 2! I feel like we finally have a database client that (1) is/will be very powerful and (2) is very approachable and easy for beginners to learn. It certainly doesn't replace the need to know some SQL, but it does delay that which is great for so many people. I'm definitely using this instead of any ORM for every project I can. I really love having the fully typed interface for Typescrip…

What are your thoughts on RedwoodJS?

https://github.com/redwoodjs/redwood

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

#33

I'm super excited about Prisma 2! I feel like we finally have a database client that (1) is/will be very powerful and (2) is very approachable and easy for beginners to learn. It certainly doesn't replace the need to know some SQL, but it does delay that which is great for so many people. I'm definitely using this instead of any ORM for every project I can. I really love having the fully typed interface for Typescrip…

What are your thoughts on RedwoodJS? https://github.com/redwoodjs/redwood

Great alternative if you don't care about Next.js and you absolutely want to use GraphQL.

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

#34
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?

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 architectures. Other examples follow:

1. You can extend it by adding business logic in the database via user-defined functions. Eg: You want a fulltext search or a PostGIS function that is better off in the DB anyway.

2. You can bring your own GraphQL server with custom resolvers and Hasura will merge them into its own API and let you “join” across them as well.

3. You can bring REST APIs and add graphql types for them in Hasura and use it as custom resolvers that extend the schema as well.

Hasura’s key value add is an instant GraphQL API backed by your own data-sources (database, GraphQL, REST) and then a fine-grained authorization system on it.

Like Nikolas said, very different from Prisma. Hasura aims to add value as “infrastructure” by guaranteeing performance and security where as Prisma is like an ORM/database toolkit.

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

#35

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…

JOOQ from jvm world is exactly that, typesafe sql with dsl pretty much the same as good ol’ SQL

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

#36

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…

Thanks a lot for the clarification, Tirumarai! (Remote JOINs look awesome btw, congrats on the release :)

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

#38

If I understand correctly, transactions are currently not supported for doing any advanced business logic beyond building CRUD: https://www.prisma.io/docs/reference/tools-and-interfaces/pr... Also, no mention of aggregations, or if someone could point me to it? As far as typed query builders go, even though things like JOOQ are simply amazing, but I fear that the query building approach has not really caught on for d…

People are scared of SQL or they want to use their objects for data access, business logic and views at the same time (leading to bad architecture and headaches), or they come from Nosql world, or they want a shiny new tool, or they do not understand features of their used db well, or because “everybody is using ORM zyz”... Just from the top of my head, there are probably more.

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

#39

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?

I think one very common characteristic of most ORMs is that tables are defined in terms of classes (often called models). You then instantiate these classes to work with the model instances for data storage and retrieval.

Prisma takes a fundamentally different approach by generating a database client that returns plain old JS objects. We've written more extensively about this topic in the docs: https://www.prisma.io/docs/understand-prisma/why-prisma

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

#40

"The problem: Working with databases is difficult" This makes me think of all brainstorming sessions I attended in my life with people asking over and over again, not convincing themselves with most answers: "Ok, guys, seriously now, what problem do we think we solving here?"

Scarily close to reality :D
Post reply on HN