You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Jeoffreybauvin (via GitHub)" <gi...@apache.org> on 2026/04/17 07:00:40 UTC

[I] Airflow db migrate from 3.1.8 to 3.2.0 : ab_permission_view_role_role_id_fkey'; check that column/key exists [airflow]

Jeoffreybauvin opened a new issue, #65402:
URL: https://github.com/apache/airflow/issues/65402

   ### Under which category would you file this issue?
   
   Airflow Core
   
   ### Apache Airflow version
   
   3.2.0
   
   ### What happened and how to reproduce it?
   
   Launch Airflow db migrate from 3.1.8 to 3.2.0 : 
   
   ```
   2026-04-17T06:53:56.915022Z [debug    ] settings.prepare_engine_args(): Using pool settings. pool_size=5, max_overflow=10, pool_recycle=1800, pid=7 [airflow.settings] loc=settings.py:508
   2026-04-17T06:53:56.918934Z [debug    ] Calling callbacks: []          [airflow.utils.cli_action_loggers] loc=cli_action_loggers.py:98
   Traceback (most recent call last):
     File "/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
       self.dialect.do_execute(
     File "/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 952, in do_execute
       cursor.execute(statement, parameters)
     File "/home/airflow/.local/lib/python3.12/site-packages/MySQLdb/cursors.py", line 179, in execute
       res = self._query(mogrified_query)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/MySQLdb/cursors.py", line 330, in _query
       db.query(q)
     File "/home/airflow/.local/lib/python3.12/site-packages/MySQLdb/connections.py", line 286, in query
       _mysql.connection.query(self, query)
   MySQLdb.OperationalError: (1091, "Can't DROP 'ab_permission_view_role_role_id_fkey'; check that column/key exists")
   
   The above exception was the direct cause of the following exception:
   
   Traceback (most recent call last):
     File "/home/airflow/.local/bin/airflow", line 6, in <module>
       sys.exit(main())
                ^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/__main__.py", line 55, in main
       args.func(args)
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/cli/cli_config.py", line 49, in command
       return func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/cli.py", line 113, in wrapper
       return f(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/providers_configuration_loader.py", line 54, in wrapped_function
       return func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/cli/commands/db_command.py", line 219, in migratedb
       run_db_migrate_command(args, db.upgradedb, _REVISION_HEADS_MAP)
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/cli/commands/db_command.py", line 150, in run_db_migrate_command
       command(**kwargs)
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/session.py", line 100, in wrapper
       return func(*args, session=session, **kwargs)  # type: ignore[arg-type]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/db.py", line 1271, in upgradedb
       _run_upgradedb(config, to_revision, session, use_migration_files=use_migration_files)
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/db.py", line 1199, in _run_upgradedb
       external_db_manager.upgradedb(work_session, use_migration_files=use_migration_files)
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/db_manager.py", line 295, in upgradedb
       self._call_with_optional_use_migration_files(m, "upgradedb", use_migration_files)
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/db_manager.py", line 274, in _call_with_optional_use_migration_files
       method(use_migration_files=use_migration_files)
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/fab/auth_manager/models/db.py", line 123, in upgradedb
       command.upgrade(config, revision=to_revision or "heads")
     File "/home/airflow/.local/lib/python3.12/site-packages/alembic/command.py", line 483, in upgrade
       script.run_env()
     File "/home/airflow/.local/lib/python3.12/site-packages/alembic/script/base.py", line 545, in run_env
       util.load_python_file(self.dir, "env.py")
     File "/home/airflow/.local/lib/python3.12/site-packages/alembic/util/pyfiles.py", line 116, in load_python_file
       module = load_module_py(module_id, path)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/alembic/util/pyfiles.py", line 136, in load_module_py
       spec.loader.exec_module(module)  # type: ignore
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "<frozen importlib._bootstrap_external>", line 999, in exec_module
     File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/fab/migrations/env.py", line 126, in <module>
       run_migrations_online()
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/fab/migrations/env.py", line 120, in run_migrations_online
       context.run_migrations()
     File "<string>", line 8, in run_migrations
     File "/home/airflow/.local/lib/python3.12/site-packages/alembic/runtime/environment.py", line 969, in run_migrations
       self.get_context().run_migrations(**kw)
     File "/home/airflow/.local/lib/python3.12/site-packages/alembic/runtime/migration.py", line 626, in run_migrations
       step.migration_fn(**kw)
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/fab/migrations/versions/0001_3_5_0_fix_fab_db_inconsistencies.py", line 241, in upgrade
       with op.batch_alter_table("ab_permission_view_role", schema=None) as batch_op:
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/python/lib/python3.12/contextlib.py", line 144, in __exit__
       next(self.gen)
     File "/home/airflow/.local/lib/python3.12/site-packages/alembic/operations/base.py", line 408, in batch_alter_table
       impl.flush()
     File "/home/airflow/.local/lib/python3.12/site-packages/alembic/operations/batch.py", line 115, in flush
       fn(*arg, **kw)
     File "/home/airflow/.local/lib/python3.12/site-packages/alembic/ddl/mysql.py", line 207, in drop_constraint
       super().drop_constraint(const)
     File "/home/airflow/.local/lib/python3.12/site-packages/alembic/ddl/impl.py", line 426, in drop_constraint
       self._exec(schema.DropConstraint(const, **kw))
     File "/home/airflow/.local/lib/python3.12/site-packages/alembic/ddl/impl.py", line 256, in _exec
       return conn.execute(construct, params)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1419, in execute
       return meth(
              ^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/sql/ddl.py", line 187, in _execute_on_connection
       return connection._execute_ddl(
              ^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1530, in _execute_ddl
       ret = self._execute_context(
             ^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
       return self._exec_single_context(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
       self._handle_dbapi_exception(
     File "/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2363, in _handle_dbapi_exception
       raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
     File "/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
       self.dialect.do_execute(
     File "/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 952, in do_execute
       cursor.execute(statement, parameters)
     File "/home/airflow/.local/lib/python3.12/site-packages/MySQLdb/cursors.py", line 179, in execute
       res = self._query(mogrified_query)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/MySQLdb/cursors.py", line 330, in _query
       db.query(q)
     File "/home/airflow/.local/lib/python3.12/site-packages/MySQLdb/connections.py", line 286, in query
       _mysql.connection.query(self, query)
   sqlalchemy.exc.OperationalError: (MySQLdb.OperationalError) (1091, "Can't DROP 'ab_permission_view_role_role_id_fkey'; check that column/key exists")
   [SQL: ALTER TABLE ab_permission_view_role DROP FOREIGN KEY ab_permission_view_role_role_id_fkey]
   (Background on this error at: https://sqlalche.me/e/20/e3q8)
   2026-04-17T06:53:56.930784Z [debug    ] Disposing DB connection pool (PID 7) [airflow.settings] loc=settings.py:541
   ```
   
   ### What you think should happen instead?
   
   No db migrate error.
   
   ### Operating System
   
   Ubuntu 24.04
   
   ### Deployment
   
   Docker-Compose
   
   ### Apache Airflow Provider(s)
   
   _No response_
   
   ### Versions of Apache Airflow Providers
   
   ```
   apache-airflow-providers-amazon==9.6.1
   apache-airflow-providers-celery==3.17.2
   apache-airflow-providers-cncf-kubernetes==10.15.0
   apache-airflow-providers-common-compat==1.14.2
   apache-airflow-providers-common-io==1.7.2
   apache-airflow-providers-common-messaging==2.0.3
   apache-airflow-providers-common-sql==1.34.0
   apache-airflow-providers-docker==4.5.4
   apache-airflow-providers-elasticsearch==6.5.1
   apache-airflow-providers-fab==3.6.0
   apache-airflow-providers-ftp==3.14.2
   apache-airflow-providers-git==0.3.0
   apache-airflow-providers-google==21.0.0
   apache-airflow-providers-grpc==3.9.3
   apache-airflow-providers-hashicorp==4.5.1
   apache-airflow-providers-http==6.0.1
   apache-airflow-providers-microsoft-azure==13.1.0
   apache-airflow-providers-mysql==6.5.1
   apache-airflow-providers-odbc==4.12.1
   apache-airflow-providers-openlineage==2.13.0
   apache-airflow-providers-postgres==6.6.2
   apache-airflow-providers-redis==4.4.3
   apache-airflow-providers-sendgrid==4.2.2
   apache-airflow-providers-sftp==5.7.2
   apache-airflow-providers-slack==9.9.0
   apache-airflow-providers-smtp==2.4.4
   apache-airflow-providers-snowflake==6.12.0
   apache-airflow-providers-ssh==4.3.3
   apache-airflow-providers-standard==1.12.2
   ```
   
   
   ### Official Helm Chart version
   
   Not Applicable
   
   ### Kubernetes Version
   
   _No response_
   
   ### Helm Chart configuration
   
   _No response_
   
   ### Docker Image customizations
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Airflow db migrate from 3.1.8 to 3.2.0 : ab_permission_view_role_role_id_fkey'; check that column/key exists [airflow]

Posted by "vincbeck (via GitHub)" <gi...@apache.org>.
vincbeck closed issue #65402: Airflow db migrate from 3.1.8 to 3.2.0  : ab_permission_view_role_role_id_fkey'; check that column/key exists
URL: https://github.com/apache/airflow/issues/65402


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Airflow db migrate from 3.1.8 to 3.2.0 : ab_permission_view_role_role_id_fkey'; check that column/key exists [airflow]

Posted by "anavrotski (via GitHub)" <gi...@apache.org>.
anavrotski commented on issue #65402:
URL: https://github.com/apache/airflow/issues/65402#issuecomment-4302523258

   3.1.6 -> 3.2.1 also fails


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Airflow db migrate from 3.1.8 to 3.2.0 : ab_permission_view_role_role_id_fkey'; check that column/key exists [airflow]

Posted by "zhaorui2022 (via GitHub)" <gi...@apache.org>.
zhaorui2022 commented on issue #65402:
URL: https://github.com/apache/airflow/issues/65402#issuecomment-4290723849

   We also run into the same issue, however, for our upgrades, 3.1.6 -> 3.2.0 works, but when upgrading from 3.2.0 -> 3.2.1rc2 fails with this error


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org