Ons <mribah....@gmail.com> wrote:

> Hello,
> 
> I have a sqlalchemy model to which i want to add a column using alembic :
> 
> from sqlalchemy_utils import UUIDType
> new_column = Column(UUIDType, primary_key=True)
> 
> When i run alembic revision --autogenerate, it generates a migration script 
> but when i run alembic upgrade head it throws the error below:
> 
>     op.add_column('my_model', sa.Column('my_model_uuid', 
> sa.UUIDType(length=16), nullable=False))
> AttributeError: 'module' object has no attribute 'UUIDType'
> 
> How can i configure alembic to generate migration scripts using data types 
> from sqlalchemy_utils ?

First off, update to the latest alembic - your custom type will no longer 
output as part of “sa.” - it will use __module__ instead.

Secondly, you can configure this fully.  See 
http://alembic.readthedocs.org/en/latest/autogenerate.html#autogen-module-prefix
 for a full documentation section on just this issue.


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to