Reputation: 267
I've just set my local application to log Prisma's queries (log: ['query']
), but I need to see what values it is using while I debug my application, which is currently not happening, my queries are being printed like this:
FROM "public"."potato" WHERE "public"."potato"."id" IN ($1) OFFSET $2
I have two questions:
Note: Not that it matters or makes a difference, but I'm using postgres.
Upvotes: 4
Views: 9644
Reputation: 1393
I think what you're looking for is https://www.prisma.io/docs/concepts/components/prisma-client/working-with-prismaclient/logging#event-based-logging.
Like this you can get the passed in parameters using the code mentioned in the docs
prisma.$on('query', (e) => {
console.log('Query: ' + e.query)
console.log('Params: ' + e.params)
console.log('Duration: ' + e.duration + 'ms')
})
The placeholders are for parameters. See here https://stackoverflow.com/a/7505842/9530790 for why parameterized queries is beneficial.
Upvotes: 5