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.

Answer from shmuels on Stack Overflow
🌐
Prisma
prisma.io › docs › data-platform › query-console
Test and run queries with Query Console - Prisma
Use Query Console to run the 3 pre-defined findMany() test queries or add and test queries of your own using the Prisma Client API for model queries.
🌐
Prisma
prisma.io › docs › data-platform › classic-projects › platform › query-console
Test and run queries with Query Console | Prisma Docs
Use Query Console to run the 3 pre-defined findMany() test queries or add and test queries of your own using the Prisma Client API for model queries.
🌐
Prisma
prisma.io › home › logging › logging › logging › logging
Logging | Prisma Documentation
const prisma = new PrismaClient({ log: [ { emit: "event", level: "query", }, { emit: "stdout", level: "error", }, { emit: "stdout", level: "info", }, { emit: "stdout", level: "warn", }, ], }); prisma.$on("query", (e) => { console.log("Query: " + e.query); console.log("Params: " + e.params); console.log("Duration: " + e.duration + "ms"); }); Query: SELECT "public"."User"."id", "public"."User"."email", "public"."User"."name" FROM "public"."User" WHERE 1=1 OFFSET $1 Params: [0] Duration: 3ms Query: SELECT "public"."Post"."id", "public"."Post"."title", "public"."Post"."authorId" FROM "public"."Post" WHERE "public"."Post"."authorId" IN ($1,$2,$3,$4) OFFSET $5 Params: [2, 7, 18, 29] Duration: 2ms ·
🌐
Vercel
qc.prisma-adp.vercel.app
Query Console
We cannot provide a description for this page right now
🌐
DEV Community
dev.to › this-is-learning › its-prisma-time-logging-4i7m
It's Prisma Time - Logging - DEV Community
January 26, 2022 - The level field can have query, info, warn, or error as values; whereas the emit field can have two values: stdout or event. If the "emit" value is equal to "stdout", the result of this log level will be written in the console, otherwise, if the value is "event", the result must be handled by a subscriber. But let’s clarify and see how to manage these logs. const prisma = new PrismaClient({ log: [ { emit: "event", level: "query", }, "info", "warn", "error", ], }); prisma.$on("query", e => { console.log("Query: " + e.query); console.log("Duration: " + e.duration + "ms"); });
Find elsewhere
🌐
Lola
lola.tech › blog › learning-prisma-with-prisma-data-platform
Learning Prisma with Prisma Data Platform - Blog
And you should be ready to make some Prisma queries. Go to Query Console tab and write your first query:
🌐
Lightrun
lightrun.com › answers › prisma-prisma-printing-full-sql-queries-with-parameters-in-debug-mode
Printing full SQL queries with parameters in debug mode
const prisma = new PrismaClient({ log: [ { emit: "event", level: "query", }, ], }); prisma.$on("query", async (e) => { console.log(`${e.query} ${e.params}`) });
🌐
Prisma
prisma.io › home › postgresql › postgresql › postgresql
How to add Prisma ORM to an existing project using PostgreSQL (15 min) | Prisma Documentation
Now you can use Prisma Client to query your database. Create a script.ts file: script.ts · import { prisma } from "./lib/prisma"; async function main() { // Example: Fetch all records from a table // Replace 'user' with your actual model name const allUsers = await prisma.user.findMany(); console.log("All users:", JSON.stringify(allUsers, null, 2)); } main() .then(async () => { await prisma.$disconnect(); }) .catch(async (e) => { console.error(e); await prisma.$disconnect(); process.exit(1); }); Run the script: bun ·
🌐
Prisma
prisma.io › home › console
General | Prisma Console | Prisma Documentation
The Console enables you to manage and configure your projects that use Prisma products, and helps you integrate them into your application: Query Insights: Inspect slow queries, connect Prisma calls to SQL, and apply focused fixes.
🌐
DEV Community
dev.to › somsubhra1 › prisma-data-platform-prisma-orm-on-cloud-2854
Prisma Data Platform - Prisma ORM on Cloud - DEV Community
September 2, 2021 - The Query console supports code highlighting, auto complete, auto saves queries and also code linting features. Prisma on cloud also allows developers to collaborate with fellow developers, just by inviting a GitHub user to the Prisma Project.
🌐
Prisma
prisma.io › home › query insights
Query Insights with Prisma Postgres | Prisma Documentation
Open the query detail view. Read the AI analysis and inspect the SQL. Copy the suggested prompt and paste it into your editor. Review the suggested change, then apply it in code or schema. Re-run the workload and compare the same signals again. In most cases, the next change falls into one of these buckets: ... const users = await prisma.user.findMany({ select: { id: true, name: true, email: true }, }); for (const user of users) { await prisma.post.findMany({ where: { authorId: user.id }, select: { id: true, title: true }, }); }
🌐
npm
npmjs.com › package › prisma-query-log
prisma-query-log - npm
import { createPrismaQueryEventHandler } from 'prisma-query-log'; import { PrismaClient } from '@prisma/client'; const prisma = new PrismaClient({ log: [ { level: 'query', emit: 'event', }, ], }); const log = createPrismaQueryEventHandler(); prisma.$on('query', log); function createPrismaQueryEventHandler( options?: CreatePrismaQueryEventHandlerArgs, ): (event: PrismaQueryEvent) => void; const defaultOptions = { /** * Boolean of custom log function, * if true `console.log` will be used, * if false noop - logs nothing.
      » npm install prisma-query-log
    
Published   Jul 01, 2024
Version   3.2.1
🌐
GitHub
github.com › prisma › prisma › issues › 5026
Printing full SQL queries with parameters in debug mode · Issue #5026 · prisma/prisma
February 19, 2020 - I am initializing prisma with {debug: true, log: ['info', 'query'],} and this is printing SQL queries without actual parameters, just ? to mask them. Wouldn't it be useful to pr...
Author   prisma
🌐
npm
npmjs.com › package › prisma-query
prisma-query - npm
November 6, 2022 - import { processFindUniqueQuery } from 'prisma-query'; const req = { query: { _expand: 'comments', 'comments.user.name': 'justin' }, }; const args = processFindUniqueQuery(req.query); // JSON.stringify is used for clean output in the console console.log(JSON.stringify(args, null, 2)); /* { "include": { "comments": { "where": { "user": { "name": "justin" } } } } } */ // above args can be passed in model.findUnique function const post = await prismaClient.post.findUnique(args);
      » npm install prisma-query
    
Published   Nov 06, 2022
Version   2.0.0
Author   Rahul Gupta
🌐
Prisma
prisma.io
Prisma | Agent Infrastructure for TypeScript
Begin with Prisma ORM, add Prisma Postgres when you need managed infrastructure, and deploy your app on Prisma Compute. Try it out in the Console ·
🌐
Prisma
prisma.io › get started › prisma orm › start from scratch › relational databases
Querying the database using JavaScript and SQL Server | Prisma Documentation
March 21, 2020 - Adjust the main function to send a create query to the database: index.js · async function main() { await prisma.user.create({ data: { name: 'Alice', email: 'alice@prisma.io', posts: { create: { title: 'Hello World' }, }, profile: { create: { bio: 'I like turtles' }, }, }, }) const allUsers = await prisma.user.findMany({ include: { posts: true, profile: true, }, }) console.dir(allUsers, { depth: null }) } This code creates a new User record together with new Post and Profile records using a nested write query.