valtyr / prisma-kysely

🪄 Generate Kysely types directly from your Prisma schema!
https://www.npmjs.com/package/prisma-kysely
MIT License
914 stars 35 forks source link

[feature] prisma dialect #74

Closed mwillbanks closed 4 months ago

mwillbanks commented 1 year ago

We've been investigating the possibility of actually leveraging kysely but actually utilizing prisma as the dialect for the connection (since the connection is actually handled via rust). The overall concept itself is rather simple, and we should be able to just drive everything off of the PrismaClient.

You can see how this is done via other dialects such as: https://github.com/igalklebanov/kysely-postgres-js which is using a javascript library for postgres connections and as such could be done in a similar fashion.

From there, it could be as simple as running $queryRawUnsafe and $executeRawUnsafe assuming that the kysely system handles the escaping itself otherwise using $queryRaw and $executeRaw if it is not.

valtyr commented 1 year ago

Hey there @mwillbanks, I've already prototyped this but haven't yet had the time to complete it. This is definitely something this library will support in the future.

mwillbanks commented 1 year ago

@valtyr awesome to hear, if you might be willing to share a branch of the prototype, it might be something that we could help with but likewise understand if it's fully conceptual at the moment.

valtyr commented 4 months ago

Somebody actually made this! https://github.com/eoin-obrien/prisma-extension-kysely