weixin_39890652 2020-11-30 11:37
浏览 0

Check Constraint support in MariaDB

Migrated issue, originally created by MartinH ()

I just found out that MariaDB since version 10.2 supports check constraints

https://mariadb.com/kb/en/library/mariadb-1021-release-notes/ https://mariadb.com/kb/en/constraint/

yet when I try to drop one via alembic, I get this error


  File "/Users/dwt/.virtualenvs/yeepa/lib/python2.7/site-packages/alembic/ddl/mysql.py", line 340, in _mysql_drop_constraint
    "No generic 'DROP CONSTRAINT' in MySQL - "
NotImplementedError: No generic 'DROP CONSTRAINT' in MySQL - please specify constraint type

if I don't specify the constraint type 'check'. But if I do, I get this


  File "/Users/dwt/.virtualenvs/yeepa/lib/python2.7/site-packages/alembic/ddl/mysql.py", line 337, in _mysql_drop_constraint
    "MySQL does not support CHECK constraints.")
NotImplementedError: MySQL does not support CHECK constraints.

This is on alembic (0.9.7) - which I believe is the latest released version.

Is there kind of a flag I can set to work around this? Of course I also have production databases which don't yet support this flag...

该提问来源于开源项目:sqlalchemy/alembic

  • 写回答

6条回答 默认 最新

  • weixin_39890652 2020-11-30 11:37
    关注

    Michael Bayer () wrote:

    see? that's why i hate putting in exception raises for things that the database would normally report an error towards, because suddenly the DB supports it.

    There were actually a bunch of issues in MariaDB's CHECK constraints that I reported to them and got fixed, and SQLAlchemy 1.2 also made a lot of adjustments to work w/ mariadb 10.2.

    but here, yes, we need DROP CONSTRAINT to at least work.

    评论

报告相同问题?