Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check Constraint support in MariaDB #479

Closed
sqlalchemy-bot opened this issue Jan 23, 2018 · 6 comments
Closed

Check Constraint support in MariaDB #479

sqlalchemy-bot opened this issue Jan 23, 2018 · 6 comments
Milestone

Comments

@sqlalchemy-bot
Copy link

@sqlalchemy-bot sqlalchemy-bot commented Jan 23, 2018

Migrated issue, originally created by MartinH (@dwt)

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-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Jan 23, 2018

Michael Bayer (@zzzeek) 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.

@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Jan 23, 2018

Changes by Michael Bayer (@zzzeek):

  • added labels: op directives
@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Jan 23, 2018

Changes by Michael Bayer (@zzzeek):

  • set milestone to "fasttrack"
@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Jan 23, 2018

Michael Bayer (@zzzeek) wrote:

Add DROP CONSTRAINT to MySQL for mariadb

Added support for DROP CONSTRAINT to the MySQL Alembic
dialect to support MariaDB 10.2 which now has real
CHECK constraints. Note this change does not
add autogenerate support, only support for op.drop_constraint()
to work.

Change-Id: I15b2425a44e4559b047b61573117fca9a46c8be3
Fixes: #479

5b34e1c

@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Jan 23, 2018

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Jan 24, 2018

MartinH (@dwt) wrote:

Wow, another stellar fast Michael Bayer fix time. Thanks a lot!

@sqlalchemy-bot sqlalchemy-bot added this to the fasttrack milestone Nov 27, 2018
vvvrrooomm pushed a commit to vvvrrooomm/alembic that referenced this issue Jan 10, 2019
Added support for DROP CONSTRAINT to the MySQL Alembic
dialect to support MariaDB 10.2 which now has real
CHECK constraints.  Note this change does **not**
add autogenerate support, only support for op.drop_constraint()
to work.

Change-Id: I15b2425a44e4559b047b61573117fca9a46c8be3
Fixes: sqlalchemy#479
vvvrrooomm pushed a commit to vvvrrooomm/alembic that referenced this issue Jan 10, 2019
Added support for DROP CONSTRAINT to the MySQL Alembic
dialect to support MariaDB 10.2 which now has real
CHECK constraints.  Note this change does **not**
add autogenerate support, only support for op.drop_constraint()
to work.

Change-Id: I15b2425a44e4559b047b61573117fca9a46c8be3
Fixes: sqlalchemy#479
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.