-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed as not planned
Labels
bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.Bug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.A reported bug.tech/enginesIssue for tech Engines.Issue for tech Engines.topic: driverAdapterstopic: raw$queryRaw(Unsafe) and $executeRaw(Unsafe): https://www.prisma.io/docs/concepts/components/prisma-cli$queryRaw(Unsafe) and $executeRaw(Unsafe): https://www.prisma.io/docs/concepts/components/prisma-cli
Description
Hi, I've been experimenting using the new driverAdapters preview feature with @prisma/adapter-pg so I can use oauth2 token login for Google Cloud SQL which is not currently supported out of the box by prisma.
Our database does not use the public schema, rather it uses one called staging. When using the built in prisma queries, they succeed as expected. However, when I use $queryRaw, raw queries that previously didn't need to be prepended with the schema now fail.
This is my code to instantiate the prisma client:
import { PrismaPg } from "@prisma/adapter-pg";
import { PrismaClient } from "@prisma/client";
import { GoogleAuth } from "google-auth-library";
import { Pool } from "pg";
const auth = new GoogleAuth({
scopes: ["https://www.googleapis.com/auth/sqlservice.login"],
});
const pool = new Pool({
host: "/cloudsql/REDACTED",
user: "REDACTED",
password: async (): Promise<string> => {
return (await auth.getAccessToken()) as string;
},
database: "uat",
ssl: false,
idleTimeoutMillis: 0,
max: 5,
});
const adapter = new PrismaPg(pool, {
schema: "staging",
});
export const prismaClient = new PrismaClient({
adapter,
log: ["info", "warn", "error"],
});This raw query works without the PrismaPg adapter, but fails when I use the adapter:
await prismaClient.$queryRaw`select * from "AccountingPeriod" limit 1`;This raw query succeeds when using the PrismaPg adapter:
await prismaClient.$queryRaw`select * from staging."AccountingPeriod" limit 1`;I'm happy to provide more information if needed!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.Bug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.A reported bug.tech/enginesIssue for tech Engines.Issue for tech Engines.topic: driverAdapterstopic: raw$queryRaw(Unsafe) and $executeRaw(Unsafe): https://www.prisma.io/docs/concepts/components/prisma-cli$queryRaw(Unsafe) and $executeRaw(Unsafe): https://www.prisma.io/docs/concepts/components/prisma-cli
