My User Model
class User(UserMixin, db.Model): __tablename__ = 'users'
where GUID is a custom type as described in sqlalchemy docs (exactly the same)
Now when i run
alembic revision --autogenerate -m "Added initial table"
I get my upgrade() as
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('users', sa.Column('uuid', sa.GUID(), nullable=False), sa.Column('email', sa.String(), nullable=False), sa.Column('password', sa.String(), nullable=False), sa.Column('created_on', sa.DateTime(timezone=True), nullable=True), sa.Column('last_login', sa.DateTime(timezone=True), nullable=True), sa.PrimaryKeyConstraint('uuid'), sa.UniqueConstraint('email'), sa.UniqueConstraint('uuid') ) ### end Alembic commands ###
but while applying the update - alembic upgrade head , I see
File "alembic/versions/49cc74d0da9d_added_initial_table.py", line 20, in upgrade sa.Column('uuid', sa.GUID(), nullable=False), AttributeError: 'module' object has no attribute 'GUID'
How can I make it work with GUID / custom type here?
python flask-sqlalchemy sqlalchemy alembic
daydreamer
source share