Does drizzle support a way to make an array transaction?
In prisma, you can do something like this
Is there a way to do something analogous in drizzle? I know you can do something like
but this makes 2 db trips instead of 1.
4 Replies
is this the same thing as https://orm.drizzle.team/docs/batch-api
Drizzle ORM - next gen TypeScript ORM
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
The bacth API is only supported in some drivers
Transactions are used to run queries serially. If the queries don't have relations between each other that you can run them parallel, you might as well just use promise.all outside a transaction
why wont the batch api work in postgres for instance? it works in prisma
if it is dependent, without the batch api it requires two trips to db
because postgres.js doesn't support batches. Whatever prisma is doing, is not batching. It's probably promise.all under the hood (which will be crazy if they are calling it
$transaction
), or just running them sequentially for you.