Closed
Description
Migrated issue, originally created by Robert Buchholz (@rbuchholz)
Alembic does not quote a constraint name (at least for MariaDB). If it contains a dot, (in the best case) MariaDB will complain (depending on the number of dots) about missing tables or databases. In the worst case, a constraint on a schema and table not referenced by the table and schema arguments might be dropped.
Actual behavior:
(Pdb) op.drop_constraint('foo.bar',table_name='baz', type_='check')
*** ProgrammingError: (pymysql.err.ProgrammingError) (1103, u"Incorrect table name 'foo'") [SQL: u'ALTER TABLE baz DROP CONSTRAINT foo.bar'] (Background on this error at: http://sqlalche.me/e/f405)
(Pdb) op.drop_constraint('fnord.foo.bar',table_name='baz', type_='check')
*** ProgrammingError: (pymysql.err.ProgrammingError) (1102, u"Incorrect database name 'fnord'") [SQL: u'ALTER TABLE baz DROP CONSTRAINT fnord.foo.bar'] (Background on this error at: http://sqlalche.me/e/f405)
Versions:
- alembic 0.9.8
- SQLAlchemy 1.2.5
- MariaDB 10.2.13
- Python 2.7.14