Feature/Question: Would like to execute query with Prisma.$queryRaw or $executeRaw

I use prisma-kysely to generate my kysely types and i find this to be a great workflow. I still like using prisma for most of my usecase because I have other implementations to enforce security and business logic. I find it unnecessary to include
pg
module if i already have a query-executor and a connection with prisma. It would be nice to do something like the following:

instead of:
   const db = new Kysely<DB>({
      dialect: new PostgresDialect({
        pool: new Pool({
          connectionString: DATABASE_URL,
        }),
      }),
    });
   const result = await db.selectFrom('person').selectAll().execute()


Use the dialect without a connection or pool:
   const db = new Kysely<DB>({
      dialect: new PostgresDialect(),
    }),
   const result = await prisma.$queryRaw(db.selectFrom('person').selectAll().compile())


Use the dialect passing a custom runner:
   const db = new Kysely<DB>({
      dialect: new PostgresDialect({ runner: prisma }),
    }),
   const result = await db.selectFrom('person').selectAll().execute()
Was this page helpful?