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"