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

Wrong class imported for SQLAlchemy #116

Closed
tux-type opened this issue Jan 28, 2025 · 1 comment
Closed

Wrong class imported for SQLAlchemy #116

tux-type opened this issue Jan 28, 2025 · 1 comment

Comments

@tux-type
Copy link

This example does not work for SparseVector and HalfVector:

from pgvector.sqlalchemy import Vector

class Item(Base):
    embedding = mapped_column(Vector(3))

When importing using:

from pgvector.sqlalchemy import Vector, SparseVector, HalfVector

Vector is correctly imported as UserDefinedType VECTOR, but SparseVector, and HalfVector are not.

from .bit import BIT
from .functions import avg, sum
from .halfvec import HALFVEC
from .sparsevec import SPARSEVEC
from .vector import VECTOR
from .vector import VECTOR as Vector
from ..utils import HalfVector, SparseVector

@ankane
Copy link
Member

ankane commented Jan 28, 2025

Hi @tux-type, see the docs for the right types to import for SQLAlchemy.

@ankane ankane closed this as completed Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants