Skip to content
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

[FEATURE]: Support for PGLite Extensions in Drizzle Studio #2995

Open
robertlong opened this issue Sep 20, 2024 · 1 comment · May be fixed by #3824
Open

[FEATURE]: Support for PGLite Extensions in Drizzle Studio #2995

robertlong opened this issue Sep 20, 2024 · 1 comment · May be fixed by #3824
Labels
db/postgres driver/pglite drizzle/studio Issues related to Drizzle Studio enhancement New feature or request

Comments

@robertlong
Copy link

Describe what you want

I'd like to be able to use the pgvector extension with PGLite and load Drizzle Studio without any modifications to my schema.

Currently in connections.ts the extensions are not passed through. Having the ability to enable extensions here would be great!

@samarjit
Copy link

[3222] seems to be asking the same support of pglite+pgvector in drizzle-studio. I feel just adding the extension vector in a hardcoded way will help unblock the usage.
const { vector } = await import('@electric-sql/pglite/vector'); const pglite = new PGlite(normalisePGliteUrl(credentials.url), { extensions: { vector } });

This will enable the use of

  1. SQL runner - creation of tables with vectors, sparsevec etc.

  2. table browser.

  3. Drizzle Runner (partially) - works for spasevec but not vector.
    Drizzle runner with vector db.select().from(items), throws Cannot read properties of undefined (reading 'dimensions'). This is due to the fact that schema files are inferred from the actual table, instead of supplied schema files. In this process it looses the dimension even though in original schema files it was passed.
    Fixing this requires updating code in drizzle-orm schema generation around schema inference from table.

Ideally I would like to initialize drizzle in a common place and pass it to drizzle.config.ts as well use the same in the application in order to avoid duplication, plus I can control all the plugins.
But still enabling pgvector with pglite in drizzle-studio should be higher priority.

Created this PR 3824.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
db/postgres driver/pglite drizzle/studio Issues related to Drizzle Studio enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants