Lucas Munhoz
06/11/2020, 6:08 AMprisma.user.findOne({...})
I would like to get the query statement only and don't make the call.
I know is possible to enable logs in the prisma client, but I am looking for something more specific where I can access the query builder result instead.
Something like prisma.user.findOne({...}).getRawQuery().
That would not make any call to the db but just get the query statement from the engine. Would be awesome!
Any directions on how I can accomplish this? Thank you!janpio
janpio
janpio
Lucas Munhoz
06/11/2020, 9:54 AMLucas Munhoz
06/11/2020, 9:55 AMJoël
const prisma = new PrismaClient({
log: ['query'],
});
// or as events
const prisma = new PrismaClient({
log: [
{
emit: 'event',
level: 'query',
},
],
});
prisma.on('query', e => {
e.timestamp;
e.query;
e.params;
e.duration;
e.target;
console.log(e);
});
Joël
Lucas Munhoz
06/23/2020, 4:02 PMJoël
janpio