“ 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.
Prisma – ORM for Node.js and TypeScript
141–150 of 260 posts
Re: Prisma – ORM for Node.js and TypeScript
#142I'm just about to start working on DB layer for our app with TypeScript. Any other alternatives to prisma you guys prefer and why?
Re: Prisma – ORM for Node.js and TypeScript
#143I think we can achieve a huge simplification in the industry if we develop a universal state-management solution that runs in the frontend and backend.
Without a consistent model, we are forced to write so much additional code to manage caching, optimistic UI updates, and offline capabilities.
Current RDBMS' are not ideal (most data is better represented as a graph), but because the relational model is so widely used in the backend, they are a good candidate for a universal data store on frontend and backend. And it is possible to represent graph-like structures in RDBMS' too, but it makes SQL querying very unfriendly.
GraphQL is an ideal language for declaratively specifying what data you need for the UI layer. If you doubt this, play around with the [Github GraphQL API][1]. It's an incredible experience to be able to explore and pluck exactly what you need. SQL and REST don't come close to this experience.
But GraphQL is essentially providing us a nicer way to write SQL compared to using JOINs, and to output it in a nested format for convenient rendering with nice typing. But it lacks a huge amount of flexibility.
So we should keep GraphQL as our API, but we should implement it client-side against a data model similar to what we use in our cloud db: SQL, and then do real-time syncing or use it as the model for our server-cache.
An added benefit is we don't have to worry anymore about what is local-state and what is server-persisted, or worry about choosing a good state management solution client-side.
The necessary pieces to make this happen don't exist at the moment, but I would have liked to use Prisma as the DB API for in-browser SQLite in the beginning.
I think there is then the opportunity to go full-stack and offer developers a client-side GraphQL library that talks to an in-browser SQL DB and to end the constant turnover in state-management libraries. I think every frontend developer is overwhelmed at this point by the proliferation of these libraries, and the simplicity they go seeking in things like "just use React.Context api", don't offer them what they will eventually need which is optimistic UI updates, offline modes, real-time collaboration, local-first experiences, etc.
I think we are all still in search of the right state management solution and it would be cool if Prisma did it!
Re: Prisma – ORM for Node.js and TypeScript
#144Can someone compare to Hasura please? What has been your experience?
Hasura is really awesome, so far as I have used it.
Now I gotta look into prisma
I almost wonder if they aren't mutually exclusive. With hasura, you need to run your own server anyways, for auth or special cases. Maybe that server could run prisma? Let hasura do the migrations, and prisma track it?
Re: Prisma – ORM for Node.js and TypeScript
#145Earlier 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…
Actually nested objects kinda suck even for frontend devs, if you're trying to keep things in sync efficiently. Often times it's much better to be able to lookup some object by ID of the entity from some Map, than consuming endpoints returning some crazy nested partial data for the current view. Depends on how much your app relies on client side caching and incremental sync of data.
This is more-true the less efficient the language is that you're using. I see people screw this up when writing e.g. dashboards that source their data from SQL, while leaning on an ORM, all the time, and it always kills performance (talking tens of seconds to minutes for things that should take a single-digit count of seconds, at worst).
What's good at turning complex relational data into a list, and fast? Yep, SQL.
Re: Prisma – ORM for Node.js and TypeScript
#146Earlier quoted context omitted.
@nikolasburk can you comment? Before compiling this list I was seriously considering using Prisma to kick off a big upcoming project. In the spirit of being open-minded I'd really like to know if I'm fundamentally misunderstanding Prisma capabilities.
This is a pretty extensive list! Are all of these points are full blockers for you or are there individual points that you care more about while others might be rather "nice to have"? If most of them are real blockers, you probably shouldn't use Prisma [1], and that's ok :) Prisma certainly is not perfect and whether you should use it depends on your project and individual requirements. What I can tell you is that we…
Most of these are pretty important to us. I did try to put lower priority items near the bottom of the list. However, I did omit several nice-to-haves already. e.g. ActiveRecord's ability to diff changes after an update (ActiveModel::Dirty)
I wouldn't say any of them are complete full blockers by themselves but cumulatively yes they prevent us from considering Prisma for most projects.
Re: Prisma – ORM for Node.js and TypeScript
#147I 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…
They have a whole blog article about why monitoring is important but don't seem come with it: https://www.prisma.io/blog/monitoring-best-practices-monitor...
Re: Prisma – ORM for Node.js and TypeScript
#148I 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…
Re: Prisma – ORM for Node.js and TypeScript
#149I am over ORMs. I am looking at the documentation for Prisma Client at the moment, and I just think to myself "yet another ORM I have to learn". I have learnt so many ORMs, it is just stupid. SQL is SQL. I wish I had spent all that time further developing my SQL skills rather than learning the latest ORMs API. For my latest large project, I just used SQL and I am happy. All I did was add some code to make sure the sn…
It took me all of 1 hour to learn how to use prisma. It’s not as hard as you make it seem. They have a vs code extension for editing the prisma schema. It’s not hard to see that you make fields “String” @unique, etc. Just make one model and that’s 80% of anything you ever need. Want to make a relation? Make a new model model Posts { users User[] } Hit save, it adds the required code to relate it to the User model. Ru…
That's because the ORM cannot do a lot. Unless you're doing extremely simple SQL queries it will not handle what you want it to do. Now what? Drop into RAW sql and lose all type safety and you are on your own.
No thanks, I started using Prisma for https://listifi.app and switched it over to knex.js because the second I hit a query that Prisma couldn't handle I was on my own. Knex on the other hand could handle everything because it's a simple query builder.
Re: Prisma – ORM for Node.js and TypeScript
#150Over a year ago, I was investigating using Prisma to be the ORM for a GraphQL API of a Postgres database. When doing a proof-of-concept, I discovered that under the hood @prisma/client was spinning up it's own GraphQL server that it would send requests to in order to generate SQL to send to postgres. This extra middleware layer between my frontend code and postgres generated some pretty poor performing queries that t…