Migrations using Vector type from pgvector #561
Unanswered
sanchezdiegog
asked this question in
Q&A
Replies: 1 comment
-
The question that you have is for Alembic. Flask-Migrate is just an integration, the actual migrations are generated by Alembic. And here is the relevant section of the Alembic documentation:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone.
There is a solution for Vector type when I make a flask db migrate - "blabla" under migration->version->xxxxxxxxxxxxxx.py
appears
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('documentos', schema=None) as batch_op:
batch_op.add_column(sa.Column('vec01', pgvector.sqlalchemy.vector.VECTOR(dim=3072), nullable=True))
batch_op.drop_column('embedding')
I need to import this
from pgvector.sqlalchemy import Vector
and modify to this.
sa.Column('vec01', Vector(dim=3072), nullable=True),
after this modification works perfect, as you know, if I need modify every model manually it's a waste of time and impossible to manage with hundred of tables.
Sorry for my english and thank you in advance.
Beta Was this translation helpful? Give feedback.
All reactions