Problem
It's a common use case to send multiple queries at once. However, right now this is not possible yet with Prisma Client.
Note: Theoretically this should also already be possible by doing the following by leveraging the built-in dataloader functionality, however the currently implemented optimizations only work for queries with the same pattern/selection set.
Promise.all([
prisma.a.findMany(),
prisma.b.findOne({ where: { id: 42 } }),
prisma.c.count()
])
Solution
I suggest to introduce an explicit batching API:
prisma.batch([
prisma.a.findMany(),
prisma.b.findOne({ where: { id: 42 } }),
prisma.c.count()
])
Additionally I also suggest to add support for executing all queries in a single transaction:
prisma.batch([
prisma.a.findMany(),
prisma.b.findOne({ where: { id: 42 } }),
prisma.c.count()
], { transaction: true })
Related: prisma/specs#356 and https://github.com/prisma/prisma-client-js/issues/349 and #667
Problem
It's a common use case to send multiple queries at once. However, right now this is not possible yet with Prisma Client.
Note: Theoretically this should also already be possible by doing the following by leveraging the built-in dataloader functionality, however the currently implemented optimizations only work for queries with the same pattern/selection set.
Solution
I suggest to introduce an explicit batching API:
Related: prisma/specs#356 and https://github.com/prisma/prisma-client-js/issues/349 and #667