roach231428 opened a new issue, #49611:
URL: https://github.com/apache/airflow/issues/49611
### Apache Airflow version
3.0.0
### If "Other Airflow 2 version" selected, which one?
_No response_
### What happened?
Hi, I'm attempting to upgrade Apache Airflow from version `2.10.0` to
`3.0.0`, but I'm encountering an issue during the **database migration step**.
The process fails with the following error during the migration step
`05234396c6fc -> d59cbbef95eb`:
```sql
FUNCTION airflow_db.uuid_generate_v7 does not exist
```
I'm running MySQL version `8.0.41-0ubuntu0.22.04.1` on Linux (`x86_64`,
Ubuntu), and using Docker Compose along with the `airflow-cli` to execute the
command:
```bash
docker compose run --rm airflow-cli airflow db migrate
```
Here are the full error logs:
```bash
...
[2025-04-23T17:13:35.516+0800] {migration.py:618} INFO - Running upgrade
05234396c6fc -> d59cbbef95eb, Add UUID primary key to ``task_instance`` table.
[2025-04-23T17:13:35.575+0800] {base.py:2008} ERROR - Error closing cursor
Traceback (most recent call last):
File
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py",
line 2005, in _safe_close_cursor
cursor.close()
File
"/home/airflow/.local/lib/python3.12/site-packages/MySQLdb/cursors.py", line
103, in close
self._discard()
File
"/home/airflow/.local/lib/python3.12/site-packages/MySQLdb/cursors.py", line
95, in _discard
while con.next_result() == 0: # -1 means no more data.
^^^^^^^^^^^^^^^^^
MySQLdb.OperationalError: (1419, 'You do not have the SUPER privilege and
binary logging is enabled (you *might* want to use the less safe
log_bin_trust_function_creators variable)')
Traceback (most recent call last):
File
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py",
line 1910, in _execute_context
self.dialect.do_execute(
File
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/default.py",
line 736, 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 280, in query
_mysql.connection.query(self, query)
MySQLdb.OperationalError: (1305, 'FUNCTION airflow_db.uuid_generate_v7 does
not exist')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/airflow/.local/bin/airflow", line 8, 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 48, in command
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File
"/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/cli.py", line
111, in wrapper
return f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File
"/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/providers_configuration_loader.py",
line 55, in wrapped_function
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File
"/home/airflow/.local/lib/python3.12/site-packages/airflow/cli/commands/db_command.py",
line 197, 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 125, in run_db_migrate_command
command(
File
"/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/session.py",
line 101, in wrapper
return func(*args, session=session, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/db.py", line
1142, in upgradedb
command.upgrade(config, revision=to_revision or "heads")
File
"/home/airflow/.local/lib/python3.12/site-packages/alembic/command.py", line
408, in upgrade
script.run_env()
File
"/home/airflow/.local/lib/python3.12/site-packages/alembic/script/base.py",
line 586, 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 95, 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 113, 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/migrations/env.py",
line 138, in <module>
run_migrations_online()
File
"/home/airflow/.local/lib/python3.12/site-packages/airflow/migrations/env.py",
line 132, 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 946, in run_migrations
self.get_context().run_migrations(**kw)
File
"/home/airflow/.local/lib/python3.12/site-packages/alembic/runtime/migration.py",
line 623, in run_migrations
step.migration_fn(**kw)
File
"/home/airflow/.local/lib/python3.12/site-packages/airflow/migrations/versions/0042_3_0_0_add_uuid_primary_key_to_task_instance_.py",
line 239, in upgrade
op.execute("""
File "<string>", line 8, in execute
File "<string>", line 3, in execute
File
"/home/airflow/.local/lib/python3.12/site-packages/alembic/operations/ops.py",
line 2552, in execute
return operations.invoke(op)
^^^^^^^^^^^^^^^^^^^^^
File
"/home/airflow/.local/lib/python3.12/site-packages/alembic/operations/base.py",
line 441, in invoke
return fn(self, operation)
^^^^^^^^^^^^^^^^^^^
File
"/home/airflow/.local/lib/python3.12/site-packages/alembic/operations/toimpl.py",
line 223, in execute_sql
operations.migration_context.impl.execute(
File
"/home/airflow/.local/lib/python3.12/site-packages/alembic/ddl/impl.py", line
253, in execute
self._exec(sql, execution_options)
File
"/home/airflow/.local/lib/python3.12/site-packages/alembic/ddl/impl.py", line
246, in _exec
return conn.execute(construct, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/future/engine.py",
line 286, in execute
return self._execute_20(
^^^^^^^^^^^^^^^^^
File
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py",
line 1710, in _execute_20
return meth(self, args_10style, kwargs_10style, execution_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py",
line 334, in _execute_on_connection
return connection._execute_clauseelement(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py",
line 1577, in _execute_clauseelement
ret = self._execute_context(
^^^^^^^^^^^^^^^^^^^^^^
File
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py",
line 1953, in _execute_context
self._handle_dbapi_exception(
File
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py",
line 2134, in _handle_dbapi_exception
util.raise_(
File
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/util/compat.py",
line 211, in raise_
raise exception
File
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/base.py",
line 1910, in _execute_context
self.dialect.do_execute(
File
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/engine/default.py",
line 736, 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 280, in query
_mysql.connection.query(self, query)
sqlalchemy.exc.OperationalError: (MySQLdb.OperationalError) (1305, 'FUNCTION
airflow_db.uuid_generate_v7 does not exist')
[SQL:
UPDATE task_instance
SET id = uuid_generate_v7(coalesce(queued_dttm, start_date,
NOW(3)))
WHERE id IS NULL
]
(Background on this error at: https://sqlalche.me/e/14/e3q8)
```
### What you think should happen instead?
_No response_
### How to reproduce
Original metadata DB: `MySQL Ver 8.0.41-0ubuntu0.22.04.1 for Linux on x86_64
((Ubuntu))`
Original Docker image: `apache/airflow:3.0.0`
Upgraded Docker image: `apache/airflow:3.0.0`
Executed command:
```bash
docker compose run --rm airflow-cli airflow db migrate
```
### Operating System
Ubuntu 22.04.1 LTS
### Versions of Apache Airflow Providers
_No response_
### Deployment
Docker-Compose
### Deployment details
_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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]