Live data from Hacker News

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

prisma.io

51–60 of 112 posts

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

#51
post #48

I've been using the beta for the past couple months on a new project along with @nexus/schema to build a GraphQL server. This hits a sweet spot for me where I'm not having to manually duplicate a bunch of information in my GraphQL schema that's easily derivable from my database schema, but I still have the freedom to implement custom resolvers and use Prisma directly (or whatever else) when I need to. It's a good sta…

Thanks so much for sharing your experiences with Prisma!

> The main problems I've run into have been around utilizing standard postgres naming patterns (snake case for tables and fields instead of camelcase) and mapping the names in the prisma schema. Ran into a handful of bugs related to having these mappings that have all been fixed since.

Better re-introspection flows are indeed very much on our radar and something that we want to tackle soon! Would be great if you could leave a comment with your use case on GitHub [1], so we can make sure to address it properly when planning and prioritizing new features! :)

> Better transaction support beyond just nested writes would be great and probably a requirement for a lot of apps.

Same here! It would be really helpful for us if you could share some details about your use cases for transactions in the feature request [2] so that we can incorporate them in our planning and design of the feature!

[1] https://github.com/prisma/prisma/issues/2425

[2] https://github.com/prisma/prisma/issues/1844

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

#52

Earlier quoted context omitted.

I get where you are coming from, but from your comment I am guessing you have yet to try Prisma. I'll speak to my personal experience... I became allergic to ORMs after experiencing much of the pain that you describe. Like you, I quickly found ORMs were simply an additional domain language / abstraction over my database that provided more pain that usefulness. Every time I wanted to make I change to the code I had to…

That sounds awful, and completely different from my experience with ORMs. My experience has almost exclusively been entity framework, which despite having some warts (rank over partition queries are impossible) has been a very pleasant experience. One advantage is the additional domain language is also the language of array/list manipulation, and not having to maintain any encoders/decoders (I honestly don't know wha…

Oh, there are two different kinds of ORM.

You are talking about one where the goal is to make querying the database more idiomatic on your development language, at the cost of some flexibility. This works very well as long as you stay within the bounds of the abstraction, and breaks terribly when you step out of it. The engineering goal is to make the abstraction just broad enough to represent most of the common queries without making it less idiomatic.

The second kind is the type that tries to abstract databases into a specialized query language. The goal here is to bring things you don't get on plain SQL (like type integration or a single DBMS independent language) without losing expressive power. That's the one the GP is talking about.

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

#53

It's funny how suddenly everyone is moving towards types. A couple of years back which was frowned upon. And was seen as anti productive.

If by "a couple" you mean 10 to 15, then yes, that's correct.

Look at the modern type systems we have around and try to see how they are different from what was mainstream by that time.

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

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

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

#55

Earlier quoted context omitted.

That sounds awful, and completely different from my experience with ORMs. My experience has almost exclusively been entity framework, which despite having some warts (rank over partition queries are impossible) has been a very pleasant experience. One advantage is the additional domain language is also the language of array/list manipulation, and not having to maintain any encoders/decoders (I honestly don't know wha…

Oh, there are two different kinds of ORM. You are talking about one where the goal is to make querying the database more idiomatic on your development language, at the cost of some flexibility. This works very well as long as you stay within the bounds of the abstraction, and breaks terribly when you step out of it. The engineering goal is to make the abstraction just broad enough to represent most of the common quer…

> and breaks terribly when you step out of it

Maybe you mean something else, but I haven't had any issues when I've had to break out of the ORM and write portions in SQL. (usually once or twice every couple of development man years)

I'm not sure what type integration is, but the ORM I'm most familiar with does allow spanning multiple DBMS's with the same code. (unless when you had to break into DBMS specific SQL for performance reasons)

Is type integration allowing static type checks against your query language? Entity Framework does this as well.

I think EF is the second type of ORM, unless I'm misunderstanding you.

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

#56

Earlier quoted context omitted.

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.

I mean... this just now is the production-ready release. Everything for the past year on prisma2 has specifically been labeled as unstable. I wouldn't rag on them too hard for having breaking changes while in an alpha/beta phase.

[deleted]

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

#57
For those of you who prefer talks over blog posts to learn about new tools, I recently gave a talk introducing Prisma 2.0 and demoed how you can use it to build a REST API and a GraphQL API with a PostgreSQL database.

You can find the full recording here: https://www.youtube.com/watch?v=AnJxKWQG_fM

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

#59

Earlier quoted context omitted.

I get where you are coming from, but from your comment I am guessing you have yet to try Prisma. I'll speak to my personal experience... I became allergic to ORMs after experiencing much of the pain that you describe. Like you, I quickly found ORMs were simply an additional domain language / abstraction over my database that provided more pain that usefulness. Every time I wanted to make I change to the code I had to…

That sounds awful, and completely different from my experience with ORMs. My experience has almost exclusively been entity framework, which despite having some warts (rank over partition queries are impossible) has been a very pleasant experience. One advantage is the additional domain language is also the language of array/list manipulation, and not having to maintain any encoders/decoders (I honestly don't know wha…

Interesting, coming from Eloquent ORM (PHP), I hated Entity Framework. It seemed to want to do far too much clever stuff (like save an entire object graph at once), and didn't have nearly as many escape hatches as I'm accustomed to (Eloquent will let you inject raw SQL nearly anywhere). I've had positive experiences like ORMs, but only when they are thin layers over the underlying SQL.

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

#60

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…

What you descrive is very similar to Rezoom.SQL for F#. https://github.com/rspeele/Rezoom.SQL

It has type checked queries in plain SQL (based on SQLite syntax), compile time consistency checks, autocomplete, schema migrations, and more. The normal queries have all the guarantees, but in case you might want to use some vendor specific features, it also has the option of vendor queries.

Very very cool library.

Post reply on HN