Skip to content

Commit 4e02d6f

Browse files
Registering Vector Type with SQLAlchemy Registries (#45)
1 parent 7ab418e commit 4e02d6f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pgvector/sqlalchemy/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from sqlalchemy.types import UserDefinedType, Float
22
from ..utils import from_db, to_db
3-
3+
from sqlalchemy.dialects import postgresql
44
__all__ = ['Vector']
55

66

@@ -35,3 +35,6 @@ def max_inner_product(self, other):
3535

3636
def cosine_distance(self, other):
3737
return self.op('<=>', return_type=Float)(other)
38+
39+
# Register Vector type to PostgreSQL's reflection subsystem
40+
postgresql.base.ischema_names['vector'] = Vector

0 commit comments

Comments
 (0)