File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 34
34
35
35
36
36
@event .listens_for (psycopg2_array_engine , "connect" )
37
- def connect (dbapi_connection , connection_record ):
37
+ def psycopg2_connect (dbapi_connection , connection_record ):
38
38
from pgvector .psycopg2 import register_vector
39
39
register_vector (dbapi_connection , globally = False , arrays = True )
40
40
41
41
42
+ if sqlalchemy_version > 1 :
43
+ psycopg_array_engine = create_engine ('postgresql+psycopg://localhost/pgvector_python_test' )
44
+ array_engines .append (psycopg_array_engine )
45
+
46
+ @event .listens_for (psycopg_array_engine , "connect" )
47
+ def psycopg_connect (dbapi_connection , connection_record ):
48
+ from pgvector .psycopg import register_vector
49
+ register_vector (dbapi_connection )
50
+
51
+
42
52
Base = declarative_base ()
43
53
44
54
You can’t perform that action at this time.
0 commit comments