Skip to content Skip to sidebar Skip to footer

Alembic Sqlalchemy Postgres "nameerror: Name 'string' Is Not Defined" Trying To Add Array(string) Fields

The Model is below plus error message below that. I am trying to create some array columns using Alembic but getting NameError: name 'String' is not defined. Any help valued. thank

Solution 1:

Apparently this is an Alembic bug: see https://bitbucket.org/zzzeek/alembic/issues/368/autogenerate-does-not-properly-transform

The fix is to edit the migration file changing

 postgresql.ARRAY(String(), nullable=True))

to

 postgresql.ARRAY(sa.String(), nullable=True))

Post a Comment for "Alembic Sqlalchemy Postgres "nameerror: Name 'string' Is Not Defined" Trying To Add Array(string) Fields"