should i use drizzle or prisma?

share

Summary of results

GPT-4o
Warning: quote links might not work while streaming
1.

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.

2.

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.

3.

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.

4.

For people who would like a more safe and structured approach (but almost as powerful and with the option to resort to SQL strings if needed) I highly recommend checking out Prisma https://www.prisma.io/

5.

I dunno, 90% of my queries are super simple and prisma does the job pretty well. In my relatively small prisma project I have a grand total of 2 raw queries.

Also prisma raw query builder and migrations are really good.

I don't see all the hate, you can mix and match both approaches just fine.

7.

Regarding TypeORM - recommending Prisma feels a bit like throwing out the baby with the bath water. If I'm reading their Github issues correctly, they are slowly starting to use JOIN statements in their generated SQL. It may be fine for an ORM to perform local joins during alpha, but anything after that really should use the features DBs provide for these kinds of basic things.

I've heard good things about Drizzle.

8.

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.

9.

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

10.

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.

12.

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.

13.

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/

14.

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)

15.

Prisma Client Go is an auto-generated query builder that enables type-safe database access and reduces boilerplate. You can use it as an alternative to traditional ORMs such as gorm, xorm, sqlboiler and most database-specific tools.

It is part of the Prisma ecosystem. Prisma provides database tools for data access, declarative data modeling, schema migrations and visual data management.

16.

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.

17.

I'm using Prisma ORM over Drizzle (didn't exist when I started).

When I need to add new data to a table I have, I just put the "new_column Type" in my prisma.schema for table X. and run "npx prisma migrate dev." Then everywhere else in my code, I already have the updated type for my object X.new_column and can access it with the guardrails of not betraying what type it is.

I'd rather do that than ALTER TABLE to create and update my read queries, while making sure I don't make a mistake in the raw SQL.

18.

A lot has changed in the past years of Prisma, it's a really great tool, to be honest, "raw sql" escape hatches to do anything raw when you need it, if you haven't tried it in years, I'd recommend you to try again since if you tried it years ago, it was a very different maturity level.

20.

How does Prisma compare to EdgeDB? Pros and cons? I have limited experiences with DBs and ORMs, but EdgeDB looks very interesting.

22.

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 :)

https://orm.drizzle.team/docs/quick-start

https://www.prisma.io/docs/getting-started/quickstart

24.

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.

25.

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...).

26.

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.

27.

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.

28.

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.

30.

https://www.prisma.io/dataguide/

Over the past few years, Prisma has been quietly building a complete zero to advanced guide to databases that I've started to refer people to and use as reference myself. It stands out to me because it is focusing on a broader topic than what you typically find in docs, it's written simply, it is super comprehensive, and it's not trying to sell something.

31.

These are more akin to Dapper which is a thin layer on top of SQL. Currently I use Prisma for JS, it's a bit better, but if you haven't used EF then you probably don't know what you're missing.

32.

Any Photoprism user out there that tried this already? How does it compare, UI and updating-wise? I'm a Photprism donor but seems that development is stalling a bit lately (just a new release in over 6 months and with not so big changes, although I still have to update to be honest)

EDIT: after a quick assessment in the doc pages/features, this seems to... blow Photoprism out of the water?

37.

Seems pretty different. Prisma is an ORM basically, while this generates HTTP REST endpoints for you.

38.

For my usage, dalle 2 is better at understanding or creating pictures that are a good start. But stable diffusion provides a better resolution and provides more settings. I sometimes use them together.

41.

I think I prefer the results from the other approaches listed in the examples, e.g. material blending: https://orikmcfly.artstation.com/projects/9zRna

42.

Dall.e is much better at understanding what you want. And sometimes stable diffusion feels a bit overfitted on some prompt (especially with cars).

But Dall.e is often behind in terms of image quality. They are nice looking from far, but a bit more blurry or weird than stable diffusion if you look closely.

However you can use boths together. These days I tend to use stable diffusion first, but when a prompt is not going well I copy paste it in dall.e and get what I meant much easily. And then I import the dall.e generated image in stable diffusion to work it a bit more and get something a bit better looking.

43.

Please remedy my ignorance if I might be wrong, but I thought Prisma was an ORM, not a true backend.

44.

Prisma is pretty good, but the migrations system doesn't really compare. If your answer to many (any?) migrations is "blow away the existing database", that's not gonna work for me. Another thing that's not gonna work for me is generating each migration by hand with SQL specific to the dialect that youre using in development, now that I'm spoiled with Django's auto-migrations. I've had good success with Prisma by using Django to simply manage the schema and using `prisma pull db` (though Prisma unfortunately errors if you are using the default type for primary keys, AutoBigInteger because it can't handle BigNumber). Prisma is basically the ORM I had in mind when I said "there has been work in this space", FYI.

I have only used NextAuth a tiny bit, but it wasn't clear to me how to, for example, extend the user model to add fields to users. I would appreciate it if you have any resources you could point me to for an example or explanation on how to achieve that. I also did not find documentation about how to add my own authentication adapter (or plugin or whatever language they use).

45.

Not really, there's no point in using prisma with EdgeDB as our own query builder is more idiomatic for our product, faster, and we gape more capable.

See also this reply by Colin: https://news.ycombinator.com/item?id=30293544

47.

How does PragmataPro vs Iosevka compare?

I use Iosevka, but am curious about PragmataPro

48.

I use Prisma and it’s far from perfect but what I love about it is you can introspect a legacy database and generate a Prisma schema, and use the database as the source of truth. You’re not tied to a 1:1 relationship between classes and tables, and the correctness of the types do not depend on tediously annotating code correctly. Excited to see more languages supported!

49.

I just use my electric drill with a paint mixer attachment, like https://www.homedepot.ca/product/a-richard-paint-mixer-16in-... and I've only had one spray incident, when I forgot to hold on to the jar while running the drill. It was epic!

50.

WunderGraph uses Prisma internally to talk to the database, so I'd say this is quite mature. Here's a more comprehensive guide about our database support: https://docs.wundergraph.com/docs/databases/prisma

51.

Do you worry about over-coupling when using Prisma? I'm hesitant to let front-end control the schema in any scenario where they're not the only users of that DB. Works great until it doesn't and can be a pain to migrate control to a backend/API team.

52.

I use monokai and dracula, depending on the environment. If i can alter something, I usually go for dracula and FiraScript as font.

53.

I use DRAKON, or a loose form of it, when I draw diagrams. I like to use a square action icon saying "GOTO <title>", where title is a rounded title icon that names a process or procedure. It's not perfect.

54.

I mean, Prisma is just awful, that's hardly a problem of soft deletes.

At my previous job we used prisma, and what a terrible system, the amount of problems I saw there. Some have been fixed since, but it shouldnt take 3 major versions of an ORM to use an actual upsert operation instead of doing

if select() then update() else insert() at the client side, which is all sorts of wrong.

Or the 50ms of latency it introduced per query by starting a separate process that generated the queries, or the lack of schema flexibility, or the idiotic new join features that transforms rows into jsons in a destructive way.

It's just bad software

55.

Prisms are Lenses through Options. They compose very similarly to Lenses and it is easy to convert a Lens to a Prism to compose Prisms from existing Lenses. Every Lens is a very simple "degenerate" Reducer (a Lens is just a getter and a setter from one "state" to another), but Prisms feel even more like "real" Reducers because of the optional states that can be involved. So Prisms and Lenses are very common composable Reducers in some styles of FP.

56.

How do these techniques handle transparent, translucent, mesh/gauge/hair like objects that interact with background.

Splashing water or Orange juice, spraying snow from skis, rain and snowfall, foliage, fences and meshes, veils etc.

57.

Unless you like shimmer inks, which will clog your nice Metropolitan or Safari. A quill pen works just fine there, if you like taking the time to DIY. More people choose glass dip pens instead.

But me, yes I'll stick to my TWSBI Eco, Pilot Custom Urushi, and Lamy 2000, with a nice Blue-Black instead.

58.

I would modify this to "Don't use Prisma if you're using serverless"

With actual servers and prisma running close to the underlying database, it should be much better.

Regarding using joins, that's not necessarily the best choice either. When using simple flat joins naively, you get a lot of repetition for the more toplevel nodes of the join tree, which eventually adds up to a lot of network traffic and allocation. (TypeORM tends to have this issue, for example)

What you really want are joins that build the JSON on the server. In MSSQL this can be as simple as `FOR JSON`. In Postgres it can get... a bit more involved - Drizzle can do it: https://github.com/drizzle-team/drizzle-orm/releases#:~:text...

This is probably okay, although I do wonder what happens after you hit the compute limits of your database server (i.e. scenarios when you don't use things like planetscale). In those cases (again, non-serverless), Prisma's choice might work better as long as it runs close to the DB. It will still likely be slower than the fancy JSON join, but probably need fewer database resources (depending on how its done).

59.

As someone who teaches both oil painting and digital painting, I find this project fascinating. They have certainly identified two of the key difference between digital and real paint:

- RYB mixing (e.g. yellow painting plus blue paint = green). I tested it on a mix of alizarin crimson plus hansa yellow to produce a cold orange (e.g. blood orange).

- Relative behavior of specific pigments. For example, a Prussian blue is almost black when applied thickly, but very chromatic when applied as thinly over white. A cerulean blue is pretty much the same in those two states. I tested this on a Prussian and the app performed well.

The app seems to make the assumption that the artist will always want the paint to mix. In a glaze, a thin transparent layer of paint is applied over dry paint. Effectively the result is a filter (the result will always be darker). To a degree, this can be faked using paint applied in a layer the blend mode of which has been set to multiply. It might be nice to add a drying brush to the tool set which selectively dries the paint to prevent mixing. Maybe also a mode switch to selectively different modes of physical application such as glazing, scumbling and dry brushing. While we are at it, why not add a Tonk mode using which thick paint can be lifted off the surface without smudging.

When I paint digitally, I mix the incredible nuance of real paint... even its smell. When I paint with oils I miss the incredible flexibility of the digital process (blend modes, compositing, even the humble undo). Never the twain...

61.

On practical how to:

1. Keep two water reservoirs for cleaning your brushes. One for warm colors and one for cool. (This prevents muddiness in your palette).

2. Knowing when to let the layers on your paper dry before further progress is vital.

3. Carry pigment from the bricks to your palette, don't mix pigments in the bricks.

On technique:

1. Experiment adding water to a pigment on your palette (More water == thinner with less Saturation and vice-versa).

2. Experiment with how wet pigments interact with other wet pigments on the paper. (More water == better flow).

3. Experiment with the paper tilt direction (water flows under the force of gravity and this can be used to create a desired affect).

4. Know how to layer (i.e., 1st layer low saturation, broad areas with high water/flow, final layer is fine detail lines with low flow/higher saturation).

5. You must understand the color wheel and how pigments may mix.

I have beef with this guidance:

> let your palette and paint bricks get dirty

Keep your bricks clean: Let your palette get dirty (if you so choose).

62.

The starting colors are actually identical. Try painting a 100% opaque color pool and then switch between Mixbox and Normal. You'll see that the colors are the same. The difference is their behavior in thinner layers - when the brush opacity is lower.

When you spread dark pigments over a white canvas, they usually turn very radiant, saturated colors. Phthalo Blue turns from dark purplish blue into turquoise for example. RGB mixing doesn't handle those saturation gains and that's why a brush stroke made in the 'Normal' mode looks way more dull than the brush stroke made in 'Mixbox' mode with the identical starting color.

This is actually an important point of pigment mixing. The saturation gains and hue shifts when pigments get spread or mixed with white are beautiful. RGB linear mixing (the 'normal' mode) doesn't capture them.

63.

Honestly, I hated Prisma for the longest time. Like, hated it. I tried to rip it out of projects multiple times. Why would you build a node library in Rust? (as one of many problems) But, I had a mental shift recently that helped me appreciate it more: I use Prisma only for features that fit neatly into an simple ORM (i.e. building a web page based on a bunch of joins). Anything else, I use raw SQL.

They released TypedSql (https://www.prisma.io/docs/orm/prisma-client/using-raw-sql/t...) which is heavily inspired by PgTyped. That lets me write raw Postgres SQL that's converted into TypeScript. The other things I do:

- If I want derived data, write views that encapsulate the transform. Prisma supports reading from views

- If I need something more complex, use DuckDB + python for analysis and write to the appropriate table.

- If I need to cache complex queries, just use a materialized view and read it as a prisma object

It's not perfect, but that let's me use prisma for what it's good at (Managing an ORM and deeply nested queries), then fall back into raw SQL for everything else.

Going straight to SQL has been a breath of fresh air, but, let's be honest, dealing with deeply nested joins really sucks when all you want to do is build a page that shows a company, all of it's people, and all of those people's relationships. ORMs are pretty handy for that last case, and I use SQL for everything else

64.

We’re using Prisma (https://prisma.io) schemas for a particular data exchange project we’re doing so that we can generate JSON schemas, SQLite schemas, PostgreSQL schemas, etc. We have even found a generator to create basic Elixir code from the Prisma schemas.

We’re not using anything else from Prisma, but if we had to implement something else in JS to talk to a database, that would be a contender for our database interface layer (there are only a couple of others that are even remotely usable, having suffered through the disaster of a Sequelize implementation). We’re more likely to use Elixir and Ecto.

65.

whats the difference between these and me scribbling random mish mash of curves?


Terms & Privacy Policy | This site is not affiliated with or sponsored by Hacker News or Y Combinator
Built by @jnnnthnn