electric-sql / pglite

Lightweight Postgres packaged as WASM into a TypeScript library for the browser, Node.js, Bun and Deno
https://electric-sql.com
Apache License 2.0
4.74k stars 79 forks source link

Support ORMs (Prisma, Drizzle ect.) #15

Open arvinxx opened 4 months ago

samwillis commented 4 months ago

do it support prisma?

Not yet, we will be able to explore ORM support once we have #17 parameterized queries

alexgleason commented 4 months ago

After #17 I will create a custom adapter for this with Kysely to play around with it.

kzlar commented 3 months ago

Also mentioned this on #8 but it would be awesome if pglite could support postgraphile ORM, I have a PoC that fails due to missing tables that are needed for introspection that I can share if there's interest.

intellix commented 2 months ago

would like to add a vote for sequelize. Not sure if there's anything ORM specific or if it would basically be an engine swap

amerryma commented 2 months ago

Also mentioned this on #8 but it would be awesome if pglite could support postgraphile ORM, I have a PoC that fails due to missing tables that are needed for introspection that I can share if there's interest.

Curious how are you using postgraphile with pglite?

sledorze commented 2 months ago

After #17 I will create a custom adapter for this with Kysely to play around with it.

out of curiosity, have you started on it ? (no pressure, this is OSS :) )

kzlar commented 2 months ago

Also mentioned this on #8 but it would be awesome if pglite could support postgraphile ORM, I have a PoC that fails due to missing tables that are needed for introspection that I can share if there's interest.

Curious how are you using postgraphile with pglite?

I posted my PoC over on postgraphile's discord: https://discord.com/channels/489127045289476126/551374822521831424/1223313956668571758 The idea is to eventually have complete e2e testing with a single process - so no need to set up a postgres server that you need to set up and tear down for every test. Still a long way to go though :)

lastmjs commented 2 months ago

Just an FYI I would like to see support for the following:

lastmjs commented 2 months ago

What special work needs to be done to support these? I was hoping the API/interface was pretty basic and generic

sledorze commented 2 months ago

Context: we wanted to use PGLite to speed up our unit tests with an in memory version.

As a feedback to save time for people trying the same :

This is not a criticism against PGLite; those are the problems all other solutions based on the same usage of bringing 'native' PG in the runtime will have.

Beside that: Great library, thanks for all efforts !

samwillis commented 2 months ago

@lastmjs Drizzle now supports PGlite as of a couple week ago. I should have updated here!

For the others, PGlite should have everything needed to build adapters/plugins for them. I'm not sure we are going to do this ourselves due to a long list of core PGlite stuff to do first. I'm very happy to do any testing or bug fixes to help out with building extensions.

For the Drizzle support they did the majority of the work and then I did a pass over it once they had tests running to fix any failures (at the time mostly our side). I am more than happy to do the same again!

samwillis commented 2 months ago

@sledorze we have a few ideas around how to improve memory usage and startup time for unit/integration testing.

What I would love to do is create a method to fork an in memory PGlite with copy-on-write of the VFS (and maybe the heap+stack, but I suspect that's hard). You could then create the database and load any data once, but then create a clean fork for each test. This should be super quick with relatively low memory usage per fork. It's not on the roadmap currently, but I hope we can look at it at some point.

xeoshow commented 1 month ago

Hi @lastmjs ,

Is it possible to support Parse Server? Since it supports the stardard pgsql. Thanks very much. https://github.com/parse-community/parse-server

nicksrandall commented 1 month ago

@alexgleason did you ever to get writing an adapter for Kysley?

alexgleason commented 1 month ago

@alexgleason did you ever to get writing an adapter for Kysley?

I could never get it working in Deno, so I gave up. It wouldn't be hard to do, though. Just fork the official postgres dialect: https://github.com/kysely-org/kysely/tree/master/src/dialect/postgres and modify executeQuery

sukeshpabolu commented 5 days ago

Eagerly waiting for this support. Make it happen.