Prisma
prisma.io › home › transactions and batch queries › transactions and batch queries › transactions and batch queries › transactions and batch queries
Transactions and batch queries (Reference) | Prisma Documentation
Below, we will call this instance tx. Any Prisma Client call invoked on this tx instance is encapsulated into the transaction. In the example below, Alice and Bob each have $100 in their account.
postgresql - Prisma: how to write transaction where results from one query are used by another query - Stack Overflow
I'm working on a project with Next.js and Prisma. In one of my API routes, I have a three queries. The results of the first and second queries are used in the third query. I'd like to do all three operations as a transaction and then return the data from the first query in the response. More on stackoverflow.com
Warning: Think twice before using Prisma in large projects
Hey there, I'm Nikolas from the Prisma team. Thanks a lot for raising these issues, we're always looking to improve so we very much appreciate feedback like this! It sounds like your main issue revolves around the size of the generated index.d.ts file, right? (Since the TS server crashing and the worsened DX are consquences of that)? Thank you as well for already pointing to the open issue for this! I understand that it must be super frustrating to have your editor become slow and autocomplete stop working because of that (and honestly, having an issue open for 4,5 yars sounds equally frustrating to me). I will raise the urgency of this to our Engineering team and hope that we'll get to this soon. We actually recently changed our approach to OSS governance and made it more transparent, exactly because of issues like that one that have been around for so long. In the meantime, could I ask you to add a comment to the issue? Ideally, you can also share your schema (maybe in a GitHub Gist ?) so that our engineers can reproduce it? Regarding JOINs, we released native DB-level joins that are using a mix of LATERAL joins and JSON aggregation about one year ago, so hopefully there shouldn't be any issues around that any more. If you do end up seeing slow queries, please open an issue ! We've invested a lot into performance in the last 1-2 years and are eager to fix any slow query we become aware of. Thanks again for sharing this and please let me know if I can help in any other way! More on reddit.com
Extending Prisma Client Methods in NestJS Services While Preserving TypeScript Typings
I think you can try to achieve so with Prisma client extension: https://www.prisma.io/docs/orm/prisma-client/client-extensions More on reddit.com
What are the biggest gotchas/weirdnesses of Prisma?
I wanted to use Prisma but reading about how it does joins in the client by performing multiple queries instead of letting the database handle that natively made me choose not to use it. https://github.com/prisma/prisma/discussions/12715 More on reddit.com
07:32
Interactive Transactions in Prisma - YouTube
How to Do Database Transactions in Prisma ORM - YouTube
06:18
How to Use Transactions in Prisma - YouTube
23:37
Transactions + Prisma + Typescript: Como e por que usar? - YouTube
03:33
How to use transactions in Prisma/Next.js/T3 Stack - YouTube
07:33
Why I needed to add prisma transactions to my SaaS - YouTube
Goprisma
goprisma.org › docs › walkthrough › transactions
Transactions – Prisma Client Go
// create two posts at once and run in a transaction firstPost := client.Post.CreateOne( db.Post.Published.Set(true), db.Post.Title.Set("First Post"), ).Tx() secondPost := client.Post.CreateOne( db.Post.Published.Set(false), db.Post.Title.Set("Second Post"), ).Tx() if err := client.Prisma....
Prisma Client Python
prisma-client-py.readthedocs.io › en › stable › reference › transactions
Transactions - Prisma Client Python
Transactions can be created using the Prisma.tx() method which returns a context manager that when entered returns a separate instance of Prisma that wraps all queries in a transaction.
DevSheets
devsheets.io › sheets › prisma › database-transactions
Prisma Database Transactions - Example & Syntax
// Sequential transaction (auto-rollback on error) const result = await prisma.$transaction([ prisma.user.create({ data: { email: 'user@example.com' } }), prisma.post.create({ data: { title: 'Post' } }), ]) // Interactive transaction with custom logic await prisma.$transaction(async (tx) => ...
DEV Community
dev.to › this-is-learning › its-prisma-time-transactions-ji5
It's Prisma Time - Transactions - DEV Community
February 16, 2023 - In this moment, Prisma handles the transactions in two ways, the first one is the official feature and the second one is in preview. Let's start from the first one. The first method to do a transaction in Prisma is using the $transaction method. This method accepts a list of operations that ...
Medium
medium.com › @fidelwole › database-transactions-in-prisma-4cd0153fed30
Database Transactions in Prisma. I was working on a project and… | by Fidelis Adewoye | Medium
December 9, 2024 - For example: Debit the sender’s account. Credit the recipient’s account. If one operation succeeds and the other fails, the system ends up with inconsistent data. Transactions ensure both operations succeed together or fail together, maintaining the integrity of the system. Prisma provides the $transaction method to group multiple operations into a single atomic transaction.
GitHub
github.com › prisma › prisma › discussions › 25034
Transactions within Client Extension Example · prisma/prisma · Discussion #25034
Prisma.defineExtension((client) => { return client.$extends({ query: { $allModels: { async $allOperations<T>({ args, query, model, operation, ...rest }: { args: any, query: any, model: any, operation: any }) { const setRLS = async (client: any)=>{ await client.$executeRaw('some rls logic...') } const checkResults = (result: any) => { if(result === 'not-valid'){ throw new Error('This is just a an example check function...') } return result } // check if this query already runs within a transaction if ((rest as any).__internalParams.transaction) { const transaction = (rest as any).__internalPara
Author prisma