Well, the logic currently does this to determine if the type is a SQLAlchemy type:
elif mod.startswith("sqlalchemy"): prefix = _sqlalchemy_autogenerate_prefix(autogen_context) return "%s%r" % (prefix, type_) else: prefix = _user_autogenerate_prefix(autogen_context, type_) return "%s%r" % (prefix, type_) so for the moment you’ll need to implement the “render_item” function as documented in http://alembic.readthedocs.org/en/latest/autogenerate.html#affecting-the-rendering-of-types-themselves. https://bitbucket.org/zzzeek/alembic/issue/261/for-type-namespace-startswith-sqlalchemy is added. Ons <mribah....@gmail.com> wrote: > i am using the latest version (alembic 0.7.3). I still have the same error > even after adding the user_module_prefix configuration. it still uses sa. as > a prefix for types from sqlalchemy_utils. > > On Monday, January 5, 2015 6:11:35 PM UTC+1, Michael Bayer wrote: > > > Ons <mriba...@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. -- 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.