-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prisma support #27
Comments
Would love to see this as well |
Just curious if you are still working on this lib and if this might come anyday? |
I am, and if it is feasible, it will :) |
I asked on slack and it seems that prisma does not use |
Not a problem... pg-mem is not specific to the The only thing that must be done is to replace whatever lib is used to send the requests, and redirect those SQL queries to pg-mem. I havent had the time to investigate how to do that with Prisma yet, but it could be simple. For instance, here is how the Slonik adapter is written, for instance (all supported libraries adapters are in this file). ... Once this is done, there also is a possibility that prisma will issue unsupported requests (such as cross joins), in which case I'll have to implement what's needed. |
It seems that integration with Prisma would be easy if pg-mem would run a server and expose a url that can be fed to prisma 🤔 |
Yup. I looked a bit into prisma, and it turns out that SQL queries are issued by Rust. (I didnt know Prisma was written in Rust !). (node) prisma -> (rust) prisma-engines -> (rust) quaint -> postgres statements (via tokio-postgres) So yes, it will be a bit invasive to try to hook quaint to execute pg-mem back in node. I'm looking into implementing a fake postgres server. It would essentially look like the other side of the mirror of pg-protocol, or more specifically for the rust version, this.... admittedly, it will be a more general solution to plug other libs/frameworks to pg-mem, but I was hoping not to implement such a low level solution 😑 |
For the record, to solve this, I've started working on pg-server, a library that can fake a postgres database. I'm working on integrating it with pg-mem, which requires some refactoring to do things right. Once this is done, it will be possible to expose a pg-mem instance via a random network port like any regular pg database. I'll keep you posted when it is finished😁 The fun in all this is that pg-server is actually much more versatile that just a network interface to pg-mem... you could use it as a a db honeypot, a proxy which intercepts/inspects/modifies postgres requests on the fly (it works quite well in conjunction with pgsql-ast-parser, the syntax parser of pg-mem), or whatever ! |
This is super exciting! Let me know if you would like me to try a beta build of the library with my codebase (it's relatively small but has some more complex operations) |
In case you want to try out, if Prisma Client would work with You should "just" need to provide the env var |
any updates about this? |
Hi, nothing new... I've worked on the refactoring I mentioned, but I've had a rough month at work, so I couldnt finish it yet. Sorry 😶 This is definitely still in my pipe, though ! But I cant give you an ETA right now, unfortunately. |
Sorry to bump, but what's the status? Really want pg-mem integration for prisma. |
I'm also interested in this. Typically in integration tests in services using MongoDB, I use https://www.npmjs.com/package/mongodb-memory-server which allows connecting by URI. Having an in-memory postgres server would enable me to write quality tests for Prisma easily. |
Hi ! A milestone has been recently reached in the refactoring that will allow this, so hopefully I will find time to get that working in the upcoming few months 🤷♂️ |
Any updates or help required with this matter? 😊 |
Really looking forward to this... |
+1 |
+1, I think it's the most promising solution for in memory database working with Prisma |
Will keep in the loop! also looking forward to this :) |
+1 that would be great |
I've just started working on a fork to work with Prisma, but happy to collaborate! |
+1 |
+1 on this one, would be extremely useful! |
+1 |
1 similar comment
+1 |
Do we have any updates on this? |
Small update from the Prisma side: prisma/prisma#5419 (comment) |
Does |
+1 |
2 similar comments
+1 |
+1 |
Another update over at the Prisma issue: prisma/prisma#5419 (comment) |
Hi ! Any PG protocol nerd out there that might know the answer to this 🙂 ? Once this is solved, me might have a real shot at closing this issue that has been there for far too long |
Investigate Prisma support
The text was updated successfully, but these errors were encountered: