In my sqlalchemy model i use sqlalchemy_utils' choicetype:
id = db.Column(db.Integer, primary_key=True)
code = db.Column(db.Integer, nullable=True)
level = db.Column(mytypes.types.ChoiceType(LEVEL))
I did everything as described here http://alembic.readthedocs.org/en/latest/autogenerate.html#autogen-module-prefix. In my model i imported choicetype from my module mytypes.types:
from sqlalchemy_utils.types.choice import ChoiceType
, in alembic/env.py i added context
context.configure(
connection=connection,
target_metadata=target_metadata,
user_module_prefix="mytypes.types."
# ...
)
, and in the script.py.mako
import mytypes.types
.The problem is when i am making revision of my model, i getting something
like this
from alembic import op
import sqlalchemy as sa
import mytypes.types
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('logging', sa.Column('level', mytypes.types.ChoiceType(length=255), nullable=True))
### end Alembic commands ###
Why alembic didn't pass "LEVEL" argument to choicetype and why it passed length=255 instead?