Live data from Hacker News

Prisma – Database tools for modern application development

prisma.io

51–60 of 88 posts

Re: Prisma – Database tools for modern application development

#51

Prisma looks good and I hope it succeeds. Another interesting and unique approach I'd love to see get more attention is Mammoth[0]. Instead of abstracting the database away, you define columns using its raw primitives (in this case, Postgres) and in return get a type-safe client, along with auto-generated migrations. I imagine this approach allows you to leverage the features of the database much more easily. And Pos…

Right, instead of abstracting away the database I think it makes sense to invest in making it attractive to use. Putting an abstraction layer (like ORM) on top of it basically hides it's amazing features.

PS. maintainer of mammoth here. Thanks for the mention.

Re: Prisma – Database tools for modern application development

#52

How is this different from any other ORM library?

You can think of Prisma as the next version of ORM technology. Prisma shares the same goals of an ORM (make data access easy), but takes a completely different approach than past ORMs.

Prisma uses introspection to generate a feature-rich, type-safe library around your database's schema to reduce or eliminate most of the downsides you traditionally associate with ORMs.

Type safety

Today's ORMs rely on query builders (e.g. await select('users').where('id', 10)) or hand-written classes (e.g. class Product ) to map an object to a row. Prisma looks to the database for the information about types and relationships to generate type-safe code specific to your database in every language (e.g. prisma.Products.FindByName("Sponge")).

Bugs caught at compile-time

Another downside of today's ORMs most of them break at runtime, rather than compile time. By generating type-safe database clients, Prisma eliminates any opportunity for breaking database changes to go unnoticed and end up in production.

Better performance

There are a couple advantages of Prisma has over traditional ORMs and raw SQL queries:

• The core of Prisma is written in Rust to have predictably high-performance and flexible caching.

• Prisma is written by database experts and administrators who have seen every database schema under the sun.

Fewer Leaks

Because Prisma has a holistic view of your database's structure, Prisma can generate an API that is better tailored to your application than a traditional ORM. There may be times when you still need to write raw database queries and Prisma will support these escape hatches, but those times are rare and are becoming less common every day.

Re: Prisma – Database tools for modern application development

#53
post #22

Earlier quoted context omitted.

(I work at Hasura) Yep! We’ve put in a lot of effort to ensure hasura Just Works on an existing db. Incidentally, to address your last point, Hasura has its own rails like migrations system and an admin UI (that allows DDL and DML) and works well with your existing migrations tooling too if you have it already. The hasura admin UI can create the rails style migration files automatically on your disk as you work on th…

First time learning about Hasura. Looks really promising with the built-in _live queries_ support, which Prisma has not yet implemented (they only have subscriptions): https://github.com/prisma/prisma/issues/1205 EDIT: Never mind, looking at the docs, it looks like they also only support subscriptions... It's understandable to not have support for live queries yet, as it's still a very under-explored territory, but i…

Answering a few points:

Hasura allows you to turn any "query" to a subscription, essentially live queries.

Hasura's query optimization is actually one of the core features. Hasura is structured as a transpiler that converts GraphQL, adds access control clauses and then renders a single SQL for the database. Very different from a typical ORM approach or the dataloader approach.

More details: https://blog.hasura.io/architecture-of-a-high-performance-gr...

Re: Prisma – Database tools for modern application development

#55
post #41

Earlier quoted context omitted.

Right. I think it was fairly clear what I meant, since Prisma cannot really help to change postgres internals (and strict typing in mysql is a bit hit&miss in the first place), but for the sake of everyone else reading this: SQL results, coming without any translation layer, are untyped. Your result could be anything from a string to an array with an infinite number of fields. It doesn’t really get more structure tha…

> SQL results, coming without any translation layer, are untyped. That would depend on the database's wire protocol, wouldn't it?

Do I really have to qualify this with ‘mainstream databases, with mainstream client libraries, in nearly all major languages’?

Re: Prisma – Database tools for modern application development

#56

I’ve tried Prisma over the last few months, but eventually decided against adopting it in our product because it seems very inflexible when working with many-to-many relationships. In particular, filtering on foreign keys doesn’t seem possible and requires SQL table joins, which (in our case) has an immensely negative performance impact. Also, the query chaining API doesn’t lend itself well to filtering on multiple r…

People facing similar issues might want to try out GRelDAL [1] (disclaimer: I am the author), a simple node.js library for bridging relational databases to graphql APIs.

It supports various strategies for loading associations, including joins and bulk sideloading (pre-edge when you know what to fetch before parent entities have been loaded, and post-edge when you need parent entities before).

It is still somewhat early stage and the scope is much narrower but it provides a great deal of control to the host application on how the operations are mapped from the graphql layer to the persistence layer.

[1] https://gql-dal.github.io/greldal/

Re: Prisma – Database tools for modern application development

#57

Hm... is this is like JOOQ[1] for non-Java languages? Or maybe more like a typed version of massivejs[2]? [1] https://www.jooq.org/ [2] https://massivejs.org/

Sorry for being out of context, but why is your name in green? This is the first time I have seen a green name in HN.

Re: Prisma – Database tools for modern application development

#58
We have been using Prisma for our newest project, and have really enjoyed it! The development experience is unparalleled in the Node.js world, it lets us move so quickly.

There are some rough edges, but the team is very responsive and they have fixed most of my minor gripes over the past months.

Overall I am happy we chose it and I would choose it again.

Re: Prisma – Database tools for modern application development

#59

Hm... is this is like JOOQ[1] for non-Java languages? Or maybe more like a typed version of massivejs[2]? [1] https://www.jooq.org/ [2] https://massivejs.org/

Sorry for being out of context, but why is your name in green? This is the first time I have seen a green name in HN.

new accounts (below 14 days I think) are colored green.
Post reply on HN