Did Prisma.raw and Prisma.sql helpers get removed?
I'm working on writing a new extension. In my code, I use the
.raw
and .sql
helpers/methods. For example query = Prisma.raw(`${query1}${query2}`)
. For Prisma 5.14 this works fine, but not in 5.15.1. I initially found it while updating lint, so thought the Property 'raw' does not exist on type 'typeof Prisma'.
error I'm seeing in the IDE may have just been cruft. But, in fact, when testing in a real client, it no longer works: Error: Prisma.raw is not a function
. This usage is still in the documentation: https://www.prisma.io/docs/orm/prisma-client/queries/raw-database-access/raw-queries#building-raw-queries-elsewhere-or-in-stages so I assume it's still supposed to be there. Do I need to change something? Is it a bug?Raw queries | Prisma Documentation
Learn how you can send raw SQL and MongoDB queries to your database using the raw() methods from the Prisma Client API.
3 Replies
Hello @philolegein 👋
I am able to access
Prisma.raw
and Prisma.sql
methods in version 5.15.1.
How are you importing the raw
and sql
methods in your file?
Have you tried restarting the Typescript server in your IDE and also invoking npx prisma generate command
? Maybe also try deleting node_modules
and install the dependencies again?Thanks Nurul — turned out to be something dumb. Somehow upgrading from 5.14.0, @prisma/client went to 5.15.1 and prisma went to 5.15.0. Not sure what went wrong with the pnpm install, but fixing that fixed the issue. Thanks again for coming back, though.
I am glad to hear that this is resolved 🙏