Tenzer opened a new issue, #36912:
URL: https://github.com/apache/airflow/issues/36912
### Apache Airflow version
Other Airflow 2 version (please specify below)
### If "Other Airflow 2 version" selected, which one?
2.8.1
### What happened?
I've upgraded our Airflow installation to the newly released version 2.8.1
and ran `airflow db upgrade`, as prompted by the message when Airflow tries to
start up.
That, however, resulted in the following stack trace:
```
[2024-01-19T16:06:41.883+0000] {migration.py:213} INFO - Context impl
MySQLImpl.
[2024-01-19T16:06:41.886+0000] {migration.py:216} INFO - Will assume
non-transactional DDL.
[2024-01-19T16:06:41.897+0000] {db.py:1616} INFO - Creating tables
INFO [alembic.runtime.migration] Context impl MySQLImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Running upgrade 10b52ebd31f7 ->
88344c1d9134, Drop unused TI index
Traceback (most recent call last):
File "/usr/local/bin/airflow", line 8, in <module>
sys.exit(main())
^^^^^^
File "/usr/local/lib/python3.11/site-packages/airflow/__main__.py", line
57, in main
args.func(args)
File "/usr/local/lib/python3.11/site-packages/airflow/cli/cli_config.py",
line 49, in command
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File
"/usr/local/lib/python3.11/site-packages/airflow/cli/commands/db_command.py",
line 69, in upgradedb
migratedb(args)
File "/usr/local/lib/python3.11/site-packages/airflow/utils/cli.py", line
114, in wrapper
return f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File
"/usr/local/lib/python3.11/site-packages/airflow/utils/providers_configuration_loader.py",
line 55, in wrapped_function
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File
"/usr/local/lib/python3.11/site-packages/airflow/cli/commands/db_command.py",
line 129, in migratedb
db.upgradedb(
File "/usr/local/lib/python3.11/site-packages/airflow/utils/session.py",
line 79, in wrapper
return func(*args, session=session, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airflow/utils/db.py", line
1623, in upgradedb
command.upgrade(config, revision=to_revision or "heads")
File "/usr/local/lib/python3.11/site-packages/alembic/command.py", line
399, in upgrade
script.run_env()
File "/usr/local/lib/python3.11/site-packages/alembic/script/base.py",
line 578, in run_env
util.load_python_file(self.dir, "env.py")
File "/usr/local/lib/python3.11/site-packages/alembic/util/pyfiles.py",
line 93, in load_python_file
module = load_module_py(module_id, path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/alembic/util/pyfiles.py",
line 109, in load_module_py
spec.loader.exec_module(module) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in
_call_with_frames_removed
File "/usr/local/lib/python3.11/site-packages/airflow/migrations/env.py",
line 117, in <module>
run_migrations_online()
File "/usr/local/lib/python3.11/site-packages/airflow/migrations/env.py",
line 111, in run_migrations_online
context.run_migrations()
File "<string>", line 8, in run_migrations
File
"/usr/local/lib/python3.11/site-packages/alembic/runtime/environment.py", line
937, in run_migrations
self.get_context().run_migrations(**kw)
File
"/usr/local/lib/python3.11/site-packages/alembic/runtime/migration.py", line
624, in run_migrations
step.migration_fn(**kw)
File
"/usr/local/lib/python3.11/site-packages/airflow/migrations/versions/0133_2_8_1_refactor_dag_run_indexes.py",
line 46, in upgrade
op.drop_index("ti_state_incl_start_date", table_name="task_instance",
if_exists=True)
File "<string>", line 8, in drop_index
File "<string>", line 3, in drop_index
File "/usr/local/lib/python3.11/site-packages/alembic/operations/ops.py",
line 1122, in drop_index
return operations.invoke(op)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/alembic/operations/base.py",
line 393, in invoke
return fn(self, operation)
^^^^^^^^^^^^^^^^^^^
File
"/usr/local/lib/python3.11/site-packages/alembic/operations/toimpl.py", line
113, in drop_index
raise NotImplementedError("SQLAlchemy 2.0+ required")
NotImplementedError: SQLAlchemy 2.0+ required
```,
### What you think should happen instead?
Ideally, the migration should run without issues, using a version of
SQLAlchemy that Airflow supports.
### How to reproduce
Upgrade an existing Airflow installation to version 2.8.1. Run `airflow db
upgrade`.
### Operating System
Docker
### Versions of Apache Airflow Providers
apache-airflow-providers-amazon==8.16.0
apache-airflow-providers-celery==3.4.1
apache-airflow-providers-common-io==1.2.0
apache-airflow-providers-common-sql==1.7.2
apache-airflow-providers-ftp==3.5.2
apache-airflow-providers-google==10.13.1
apache-airflow-providers-http==4.5.2
apache-airflow-providers-imap==3.3.2
apache-airflow-providers-mysql==5.5.1
apache-airflow-providers-sqlite==3.4.3
### Deployment
Other Docker-based deployment
### Deployment details
_No response_
### Anything else?
SQLAlchemy related packages:
Flask-SQLAlchemy==2.5.1
marshmallow-sqlalchemy==0.26.1
SQLAlchemy==1.4.49
sqlalchemy-bigquery==1.8.0
SQLAlchemy-JSONField==1.0.1.post0
sqlalchemy-redshift==0.8.14
sqlalchemy-spanner==1.6.2
SQLAlchemy-Utils==0.41.1
Alembic is at version 1.12.0.
### 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]