Pan Luo
2014-12-24 18:40:20 UTC
According to the doc
here: http://alembic.readthedocs.org/en/latest/batch.html#including-unnamed-unique-constraints, sqlalchemy
(<1.0) doesn't reflect the unique constraint. So when I drop it, I got:
"ValueError: No such constraint: 'uq_Criteria_name'" error. Here is my
code:
convention = {
"ix": 'ix_%(column_0_label)s',
"uq": "uq_%(table_name)s_%(column_0_name)s",
"ck": "ck_%(table_name)s_%(constraint_name)s",
"fk": "fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s",
"pk": "pk_%(table_name)s"
}
with op.batch_alter_table('Criteria', naming_convention=convention) as
batch_op:
batch_op.drop_constraint('uq_Criteria_name', type_='unique')
Where 'name' is the column in Criteria table. Did I missing anything? Is
there any way to drop the unique constraint? Thanks.
here: http://alembic.readthedocs.org/en/latest/batch.html#including-unnamed-unique-constraints, sqlalchemy
(<1.0) doesn't reflect the unique constraint. So when I drop it, I got:
"ValueError: No such constraint: 'uq_Criteria_name'" error. Here is my
code:
convention = {
"ix": 'ix_%(column_0_label)s',
"uq": "uq_%(table_name)s_%(column_0_name)s",
"ck": "ck_%(table_name)s_%(constraint_name)s",
"fk": "fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s",
"pk": "pk_%(table_name)s"
}
with op.batch_alter_table('Criteria', naming_convention=convention) as
batch_op:
batch_op.drop_constraint('uq_Criteria_name', type_='unique')
Where 'name' is the column in Criteria table. Did I missing anything? Is
there any way to drop the unique constraint? Thanks.
--
You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alembic+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alembic+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.