Closed frieda-huang closed 1 month ago
Hi @frieda-huang, it sounds like the vector_embedding
column was created as a vector
type instead of vector[]
(you can check this in Postgres directly). I added a test case in the commit above to confirm that SQLAlchemy creates it correctly.
Hi @frieda-huang, it sounds like the
vector_embedding
column was created as avector
type instead ofvector[]
(you can check this in Postgres directly). I added a test case in the commit above to confirm that SQLAlchemy creates it correctly.
Thank you so much! It was indeed the issue!!
Hi, I have the following schema to store multiple vectors, but I kept getting error telling me the mismatch between column type and the expression type.
Error
sqlalchemy.exc.ProgrammingError: (psycopg.errors.DatatypeMismatch) column "vector_embedding" is of type vector but expression is of type vector[] LINE 1: ..._embedding, dim, embedding_type, page_id) VALUES ($1::VECTOR... ^ HINT: You will need to rewrite or cast the expression. [SQL: INSERT INTO embedding (vector_embedding, dim, embedding_type, page_id) VALUES (%(vector_embedding)s::VECTOR(128)[], %(dim)s::INTEGER, %(embedding_type)s::VARCHAR, %(page_id)s::INTEGER) RETURNING embedding.id]