potiuk edited a comment on issue #13222: URL: https://github.com/apache/airflow/issues/13222#issuecomment-749046448
Actually looks like Percona implements their own MySQL replacement (https://www.percona.com/doc/percona-server/5.7/index.html) , so this might be non fully-compatible MySQL engine.. Can you please escalate to them (CC: this ticket and comment) and see whether they can confirm it? It looks like MySQL client that you use might simply not recognize the constraint type that is being dropped. So this might be both - problem with the version of your client libraries or with the Percona SQL Server not able to provide the constraint type to the client. Below is the relevant code within Alembic that is responsible for the error. It looks like the foreign key constraint read from the schema ('known_event_user_id_fkey') is not properly recognized as one of the known constraint types (should be recognized as schema.ForeignKeyConstraint). It might also be a problem with some old MySQL client libraries you are using in your Airflow installation. Seems there is a similar problem reported by someone which was gone after upgrading the client libraries: https://www.reddit.com/r/flask/comments/2puang/error_using_sqlalchemy_alembic_and_flaskmigrate/ Here is the code that raises the problem: ``` @compiles(schema.DropConstraint, "mysql") def _mysql_drop_constraint(element, compiler, **kw): """Redefine SQLAlchemy's drop constraint to raise errors for invalid constraint type.""" constraint = element.element if isinstance( constraint, ( schema.ForeignKeyConstraint, schema.PrimaryKeyConstraint, schema.UniqueConstraint, ), ): return compiler.visit_drop_constraint(element, **kw) elif isinstance(constraint, schema.CheckConstraint): # note that SQLAlchemy as of 1.2 does not yet support # DROP CONSTRAINT for MySQL/MariaDB, so we implement fully # here. if _is_mariadb(compiler.dialect): return "ALTER TABLE %s DROP CONSTRAINT %s" % ( compiler.preparer.format_table(constraint.table), compiler.preparer.format_constraint(constraint), ) else: return "ALTER TABLE %s DROP CHECK %s" % ( compiler.preparer.format_table(constraint.table), compiler.preparer.format_constraint(constraint), ) else: raise NotImplementedError( "No generic 'DROP CONSTRAINT' in MySQL - " "please specify constraint type" ) ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
