“should i use drizzle or prisma?”
Summary of results
do yourself a favor and ditch Prisma. It's a bloody mess of a project and codebase. I recommend https://github.com/drizzle-team/drizzle-orm to anyone that'll listen.
Drizzle-kit, the migration part of drizzle is not open source, though they said they will open source it in future, but not at this point. Kysley is 100% open source, feature rich and more stable, again back to active development.
atlasgo io looks promising to handle migrations and is open source as well. I am currently using prisma.
I confirm it works perfectly in CI and locally. I'm using it in CI and locally.
Not sure about Prisma but it works with Drizzle ORM.
You should consider the similar reasons why you chose Kysely over Prisma. Prisma has far broader adoption. https://npmtrends.com/drizzle-orm-vs-kysely-vs-prisma
Prisma focuses on backend<->db while Remult also handles frontend<->backend
I've really been loving Prisma https://www.prisma.io/
I've been evaluating both (kysely, drizzle), and I'm leaning towards Kysely. Drizzle is the latest, but both are moving fast if you look at the git insights. I find Kysely more enjoyable and straightforward -- intellisense autocompletions work better (for me at least), and the expression builder combined w/ helper methods like jsonArrayFrom offer a lot of flexibility over how to shape the output, so you're in full control, which is one of the reasons I wanted to explore alternatives to primsa in the first place. I had actually decided on kysely, but am taking another look at drizzle because of recent support for relations added. The added support is a nice addition, but there's boilerplate one needs to write to take advantage of and, frankly, I just find it easier to get same results w/ kysely, again, w/ added flexibility (it is not trying to be an orm). Some things I really like about drizzle are not needing to generate schema and lets you map column names (e.g., created_at db col maps to createAt object name). Drizzle can also infer types from schema, but, I haven't found this to be a big pro relative to kysely because 1) it takes very little effort to build a zod schema that "satisifies" the kysely type definitions and 2) I'm overriding the drizzle inferred types anyway to get the finally runtime checks implemented (e.g., is a cuid2 of 16 len, not just is a string). I've also been using prisma-kysely, which gives me ubiquitously supported prisma tooling for handling migrations, etc.
edit: while not exhaustive, I'm seeing better perf (by about 20%) using kysely compared to drizzle for identical queries on planetscale. Take this with a grain of salt since I've made no attempt to measure exhaustively, or optimize -- just using "as-is" so to speak, but thought it would be with noting and nothing to indicate to me that drizzle offers big perf improvement over kysely as has been suggested. Thanks for this post btw. Drizzle is hot and shiny right now (Theo just promoted big time), but after taking a second look at drizzle and in the process of writing up my thoughts here, it's become clear to me that I'm sticking w/ kysely.
Can DRIZZLE help to achieve higher resolution? Though with hundreds of photos this will imply a lot of work:
Love Prisma. Been using this for a few side projects as well as on my company projects, and it worked out really well for us.
Prisma is a nice product but I wouldn’t use it in production yet. It is prone to race conditions as it does not use native upserts, opting instead for Rails-style check-if-exists-insert-if-doesnt.
Haven’t used prisma but I think their query builder type checks (not just the results) which make composing and writing them quite a bit more convenient than the example shows.
We have had a wonderful experience with https://prisma.io
Currently using Prisma and Remix which both have some weight behind them and are pretty easy to get going with.
using a prism, maybe?
Prisma is good for writing simple selects, updates, and deletes. But the moment you need to write any kind of advanced query with joins, nested queries, unions, etc. it gets frustrating very quickly.
Kysely and Knex are far more flexible for writing complex queries and don't get in your way.
When I used prisma a few years ago I was not impressed and it couldn't do a lot of what I needed so I had to dump into raw sql queries anyway. It was easier for me to use knex and get the types mostly right.
Nice, looks promising. How does this compare to drizzle?
Context:
We've had a lot of ORM frameworks come and go in node.js - sequelize, typeorm etc, but none of them have really caught on.
Things have been changing a lot lately after typescript took over, so we've seen a bunch of ORMs take off that give you a really good typescript experience.
So, the juggernaut in this space is of course prisma, which is super expressive and over all pretty decent - it comes with its own way to define schemas, migrations etc .. so that might not be everybody's cup of tea. (and then there's the larger runtime, that have lambda-users complaining - though that has mostly been addressed now where the binary is much smaller)
So despite it being a pretty opinionated framework really, what it gives you are really rich typescript integrated queries. And all in all it works pretty well - i've been using it at work for about 3 years and I'm just really pleased with it for the most part.
The newcomer in the space that's gaining a lot of traction is Drizzle - where it's mostly a way to define tables and queries - it also gives you really rich typed queries - and it happens all in TS/JS land.
this project of yours reminds of drizzle - kind of similar in a lot of ways.
I'm super interested to understand how this compares to drizzle and which problems with drizzle this attempts to solve
Do you like Prisma?
I think it's cool but it sucks that their prisma schema doesn't support constraints and more complex things. It is very basic and for any real world use migrations need to be used.
And I've had issues using it with SQLite. It doesn't support case insensitive filtering when using SQLite (I know, neither does SQLite). But as a result, i have to build a custom query which is pretty much what i wanted to avoid by using Prisma.
Been using Drizzle for the past couple of weeks and liking it a lot. Their relation feature is awesome and solves the n+1 problem very nicely.
Isn't Prisma just a SQL ORM that you use on the server?
Prisma is pretty good, but I'm hoping they pay attention to migrations soon and reverse the decision not to use transactions in migrations.
I'll likely start diving into probabilistic formal methods in a few months and this seems like a good place to ask: How does Storm [1] compare to PRISM?
It looks like a promising alternative and the academic pedigree seems top-notch, but I would like to know more from anyone with hands-on experience with it.
Prisma does the heavy lifting on our project:
I don't have experience with Knex so I, unfortunately, don't have an answer to your question.
Completely off-topic, but do you like prisma, and how are you using it (scale, complexity, solo vs team, etc).
I toyed around with it a while back, and it looked potentially awesome, but different enough that I was worried about using it on a work project in case it failed in some use case.
Im so sick of the SQL ORM situation in Typescript, but Prisma might have an answer.
Prisma maybe? https://www.prisma.io/
It's mostly part of a JS/TS ORM, but it uses a declarative schema language, and there are libraries in other languages to parse and process it. E.g. https://prisma-client-py.readthedocs.io/en/stable/
As someone who uses both prisma and knex (so something like kysely):
Prisma is very very nice, it has maybe the best DX out there. My issue with it is performance. It is much slower than query builders or raw sql. It's also a huge black box, although I haven't had any issues, you're dealing with a complex beast.
Knex (and other query builders) is nicer than raw sql, has good performance, and it's fairly transparent (it's not a 800 pound gorilla like Prisma)
Photoprism might be worth a look
Curious why have you decided for Drizzle over Kysely.
I was recently exploring the space, and Kysely came on top as a framework with broader adoption.
If you're interested in trying out Prisma for yourself, consider using Amplication as a starting point for your next project. With Amplication's built-in Prisma integration, you can easily create a fully functional backend with Prisma, NestJS, GraphQL, REST API and more
Prisma uses rust for two main reasons from what I understand. 1) to keep the engine portable and maximize code reuse, to make projects like this Python adapter possible for example 2) under the hood Primsa does not use joins. It does a waterfall of queries (but not n+1), then stitches the data together in memory, which happens in the rust engine for performance reasons
Prisma is a nice DB client library but does't do any of the things I'm interested in - reactive queries on the client, recursive graph traversal, raising level of abstraction for the organization. Schematizing the DB & a type-safe DB client is nice, but I'm more interested in stuff one or two levels of abstraction up. Like, after the data comes into memory Prisma is done and out of the picture. But getting the data into memory is the easy part IMO. Traversing it, adding permissions and business logic, managing & composing mutations, dealing with caching and reactivity.. that's the good stuff, and I'm not sure what if any Prisma offers there.
I havent been following closely, but Prisma just landed $40m series B, & their announcement describes it as an intent to grow into an "Application Data" platform. https://news.ycombinator.com/item?id=31251167
How does Prisma compare to EdgeDB? Pros and cons? I have limited experiences with DBs and ORMs, but EdgeDB looks very interesting.
Thanks for the feedback, I will add that.
> Prisma Python
I originally decided to go with Prisma Client Python however I found this to be too verbose and have recently used Prisma Python. I do need to decide on one and stick with that. Thanks for pointing that out
Photoprism?
Was Prism PD your own thing?
I rarely see SQL Server being used alongside Next.js. But Prisma is quite popular in js land. There's also DrizzleORM, which is still relatively new. I'd recommend spending some time exploring both to see what fits you best :)
It would be nice to be able to export to Prisma.
Another "almost" like SQL library that I've heard floating around:
https://github.com/drizzle-team/drizzle-orm
I think I've reached the limits of Prisma and embarrassingly I'm thinking about ripping it out. The benefits of not having to constantly reference your DB schema and having IDE guidance is not matching up to the idiosyncrasy and incomplete DB support of Prisma.
Do what's best for the situation, WET/DRY principles both have valid application use cases. They should be used to leverage the most advantageous effect for your usage.
How does this differ from Prisma? https://www.prisma.io/.
I do like the quick bootstrapping Remult offers via "JSON db" if one hasn't set up a DB yet. And entity classes defined as a .ts file is nice, as opposed to Prisma's DSL (e.g. schema.prisma file).
Those are not prism. Prism implies it used as dispersion component, which is not the case. The thing does the real work there is the dichroic thin film coating on those prism shaped glass.
Prisma is also an interesting case as it used to be queried via GraphQL but now they use their own query language. It’s still quite useful to build GraphQL based APIs though.
> Prisma, a next-generation ORM for TypeScript which means that the core query building and connection handling has been battle tested, getting around a potential concern with adopting a new ORM.
Can I suggest you put this at the top of your README.md file, as I had never heard of Prisma before and it would have helped.
> Prisma Python
Is your program called Prisma Python or Prisma Client Python? You seem to be inconsistent with naming.
I went down the Prisma path investigating JavaScript ORMs, and... I have opinions. :)
I feel that what we have would be useful within a Prisma context, but given their complexity and how Prisma works, it's likely not very practical with their "engine".
What are you using for your ORM? Last I checked Prisma is the new hotness, but it's testing story is frankly unacceptable (i.e. manual DB purges, https://www.prisma.io/docs/orm/prisma-client/testing/integra...).
At Prisma, our long-term vision is to bring the kind of complex application data infrastructure that is common in the Java and .NET ecosystems to the TypeScript ecosystem, where great DX and quick delivery is a core expectation. That's what we call DataDX. Many companies share this vision for a better future, and by giving it a name, I hope we can make progress together faster.
For a thorough deep-dive on what we are all about, I highly recommend this book by Martin Kleppann: https://dataintensive.net/. And for a more hands-on example, take a look at this session from QCon: https://twitter.com/gunnarmorling/status/1709925808511529148
It's a solo project, CRUD stuff, but having used pretty much all JavaScript/TypeScript ORMs in existence, I can say that Prisma is way ahead of the competition. I would personally recommend it. A traditionally cumbersome and annoying thing about trying a new ORM is that you basically have to re-learn a pseudolanguage for building SQL queries but that hasn't been an issue this time, thanks to ChatGPT. So overall, happy with Prisma and plan to keep using it.
Our Prisma schema resides in our "backend" (Prisma essentially governs our master API). So I'm not sure why you're concerned that the front-end might control the schema.
The nicest thing about Prisma is that it is a declarative single-source-of-truth for our data models. Everything resides in one schema, all changes to database models and all migrations run through Prisma, and, best of all, strong types are inherently built in.
The team is also building useful middleware like field-level encryption; all of this together makes Prisma a very complete package.
Of course, there is a price for this convenience — we sacrifice some higher-level DB-side features. But Prisma is such a competent tool that we don't miss them much.
This is really interesting, we're also using Prisma, still on Prisma 1 unfortunately. But what has your learning curve for PlanetScale been like? Is there any maintenance or gotchas you have experienced that you didn't realize going into using them?
Prisma won't work with D1 out of the box. The primary limitations are:
- SQLite is traditionally embedded in an application, so Prisma interacts with it by mounting a file. Workers does not have a local filesystem, and D1 is exposed over the network through an API accessible from a Worker. Prisma will have to create a specific connector for D1.
- Workers have a script size limit which is currently 1MB. My understanding is that Cloudflare will be increasing this in the future. We also have specific work to decrease the size of Prisma. Both of those will have to happen before Prisma could be used with D1.
Note that Prisma already support querying Postgres, MySQL, SQL Server and MongoDB from Cloudflare Workers through the Prisma Data Proxy, which will see a GA release next month.
We are also very excited about D1 as a way to bring a subset of data closer to users in order to deliver faster experiences. We hope this will be a way to bring the benefit of edge computing to larger organisations who cannot simply rearchitect everything to run on Workers.
I bought the full set of Pragmata Pro on sale, but I also really like Iosevka.
If you like the style (slender/condensed), both are very appealing.
Pragmata Pro is several notches above in overall quality IMHO. Hand-hinting at smaller sizes makes a world of difference if this is important to you. This means you can use the same font from low-res console to a 4k monitor and will consistently look wonderful.
At higher DPI settings, Pragmata has a more cohesive sense of style. This is hard to quantify as it's quite subjective, but as pixel-perfect issues go away, the overall artistic direction start to become very important IMHO. The fact that this is done by a single individual shows in both little details and overall direction.
I'm not trying to push Pragmata, I just want to say that I think the price is fully justified and absolutely worth it. The work that went into the fontset is absolutely huge.
And as I said before, I also like Iosevka. Wonderful effort as well. It's slightly less packed, which I'm not super-fond of, and I find it only really shines if you have a high-DPI monitor. I use the different stylistic sets in my editor to subtly highlight different keywords.
I've been dabbling with Prisma after almost a decade of staying away from ORMs such as EJB3 / Hibernate / iBatis.
With Prisma I like the ability to generate migrations and the DB schema from a single schema definition file. I also like the autogenerated simple crud use cases.
It did not take long to have to go raw. A simple case of selecting the top most occurring unique columns from a table with a join to limit by user id is brutally trivial oneliner in SQL that just rolls off the keyboard. I took a good try to do the same with Prisma and I believe it can be done, but the complexity of what the DSL will look like is laughable.
So I still have the same opinion I've had for these past years, ORMs are okay for simple crud stuff but the moment you need something slightly beyond that bailing for the raw sql is the best thing that you can possibly do for the maintenance team that comes after you have changed projects.