-
Notifications
You must be signed in to change notification settings - Fork 256
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
Add Support for pgvector Extension #301
Conversation
Changes Made: pip install git+https://github.com/hoomano/sqlacodegen.git@feature-pgvector#egg=sqlacodegen\[pgvector\] Issue: /Users/kellyroussel/anaconda3/lib/python3.10/site-packages/sqlacodegen/cli.py:81: SAWarning: Did not recognize type 'vector' of column 'embedding'
metadata.reflect(engine, schema, not args.noviews, tables) |
Could you also add a note to the changelog? |
Co-authored-by: Alex Grönholm <alex.gronholm@nextday.fi>
You'll need to add the other suggested change too (I can't do it for you as you prevented me from modifying the branch). |
Co-authored-by: Alex Grönholm <alex.gronholm@nextday.fi>
Alright, if you're okay with me merging this now, then remove the draft status please. |
@agronholm Thank you for that. Problem is I'm not sure this is working ! I have verified that pgvector is correctly installed when using the command:
However, despite successful installation, running the sqlacodegen command line to export PostgreSQL database models results in the following warning:
I don't know if I'm wrong with the installation command ( |
I thought you already tried it before sending this PR. Did you check if |
Adding |
Thank you for the correct syntax. I can also confirm the pgvector extension is installed correctly. |
Have you managed to get it work on a local checkout? If importing |
It looks like |
What if you change it to |
You could also try to add: import pgvector.asyncpg
import pgvector.psycopg
import pgvector.psycopg2 |
I managed to add:
Those are correctly imported but I still face the same error when running sqlacodegen command... |
And you're using the |
According to the README, these types need to be explicitly registered with a connection :P |
Too bad |
You seem to understand what's the problem but I don't get it ! What part of the README are you referring? Is there anything I can do to implement what's missing? |
Scratch that part about registering types on a connection. What needs to happen is for |
PR submitted to pgvector-python repo 🤞 |
Awesome, now we just need to wait for a release. |
pgvector = None | ||
print("Import error") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pgvector = None | |
print("Import error") | |
pass |
**UNRELEASED** | ||
- Added support for the ``pgvector`` extension |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**UNRELEASED** | |
- Added support for the ``pgvector`` extension | |
**UNRELEASED** | |
- Added support for the ``pgvector`` extension (PR by KellyRousselHoomano) |
I made the necessary changes on my own and credited you in the changelog. |
Ow thank you !! |
Hi ! Thank you @agronholm and @KellyRousselHoomano for the project and the feature, this is much appreciated :) I have a problem when installing from github, I still have this issue: To install I ran (Although when installing from the @KellyRousselHoomano fork everything seemed to work) Thanks ! |
I'm also still running into this issue, versions installed:
Output of sqlacodegen (abbreviated for clarity)
Mapping of embedding is output as
|
@KellyRousselHoomano is it working for you? |
Hi, Trying to understand what's the difference... |
@agronholm on this repo master branch try:
import pgvector
except ImportError:
pgvector = None While in my PR (and on Hoomano's fork branch) it is: try:
import pgvector.sqlalchemy
except ImportError:
pgvector = None I think this might be the issue ! |
Indeed. I've pushed a fix now. |
There's a new release out now. |
All good with |
This pull request aims to enhance sqlacodegen's capabilities, allowing users to seamlessly integrate their PostgreSQL databases with pgvector for advanced data types such as 'Vector.' The feature caters to the increasing demand for efficient handling of embeddings in the context of Large Language Models (LLMs) and retrieval tools.