Skip to content

Commit 9dac871

Browse files
committed
Mmigrate to connexion 2.15
1 parent 2cd640c commit 9dac871

File tree

8 files changed

+24
-33
lines changed

8 files changed

+24
-33
lines changed

airflow/migrations/versions/0095_2_2_4_add_session_table_to_db.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626

2727
from __future__ import annotations
2828

29-
import sqlalchemy as sa
30-
from alembic import op
31-
3229
# revision identifiers, used by Alembic.
3330
revision = "c381b21cb7e4"
3431
down_revision = "be2bfac3da23"
@@ -41,17 +38,18 @@
4138

4239
def upgrade():
4340
"""Apply Create a ``session`` table to store web session data."""
44-
op.create_table(
45-
TABLE_NAME,
46-
sa.Column("id", sa.Integer()),
47-
sa.Column("session_id", sa.String(255)),
48-
sa.Column("data", sa.LargeBinary()),
49-
sa.Column("expiry", sa.DateTime()),
50-
sa.PrimaryKeyConstraint("id"),
51-
sa.UniqueConstraint("session_id"),
52-
)
41+
# We do not have to create session any more - it is automatically created by Flask-Session 0.8.0+
42+
# op.create_table(
43+
# TABLE_NAME,
44+
# sa.Column("id", sa.Integer()),
45+
# sa.Column("session_id", sa.String(255)),
46+
# sa.Column("data", sa.LargeBinary()),
47+
# sa.Column("expiry", sa.DateTime()),
48+
# sa.PrimaryKeyConstraint("id"),
49+
# sa.UniqueConstraint("session_id"),
50+
# )
5351

5452

5553
def downgrade():
5654
"""Unapply Create a ``session`` table to store web session data."""
57-
op.drop_table(TABLE_NAME)
55+
# op.drop_table(TABLE_NAME)

airflow/providers/fab/provider.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ versions:
4545

4646
dependencies:
4747
- apache-airflow>=2.9.0
48-
- flask>=2.2,<2.3
48+
- flask>=2.2,<3
4949
# We are tightly coupled with FAB version as we vendored-in part of FAB code related to security manager
5050
# This is done as part of preparation to removing FAB as dependency, but we are not ready for it yet
5151
# Every time we update FAB version here, please make sure that you review the classes and models in

airflow/utils/db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ def _get_flask_db(sql_database_uri):
764764
flask_app.config["SQLALCHEMY_DATABASE_URI"] = sql_database_uri
765765
flask_app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
766766
db = SQLAlchemy(flask_app)
767-
AirflowDatabaseSessionInterface(app=flask_app, db=db, table="session", key_prefix="")
767+
AirflowDatabaseSessionInterface(app=flask_app, client=db, table="session", key_prefix="")
768768
return db
769769

770770

airflow/www/extensions/init_session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def make_session_permanent():
4444
elif selected_backend == "database":
4545
app.session_interface = AirflowDatabaseSessionInterface(
4646
app=app,
47-
db=None,
47+
client=None,
4848
permanent=permanent_cookie,
4949
# Typically these would be configurable with Flask-Session,
5050
# but we will set them explicitly instead as they don't make

airflow/www/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
from flask import request
2020
from flask.sessions import SecureCookieSessionInterface
21-
from flask_session.sessions import SqlAlchemySessionInterface
21+
from flask_session.sqlalchemy import SqlAlchemySessionInterface
2222

2323

2424
class SessionExemptMixin:

dev/breeze/tests/test_packages.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def test_find_matching_long_package_name_bad_filter():
158158
"apache-airflow>=2.9.0",
159159
"flask-appbuilder==4.5.2",
160160
"flask-login>=0.6.2",
161-
"flask>=2.2,<2.3",
161+
"flask>=2.2,<3",
162162
"google-re2>=1.0",
163163
"jmespath>=0.7.0",
164164
""",
@@ -171,7 +171,7 @@ def test_find_matching_long_package_name_bad_filter():
171171
"apache-airflow>=2.9.0.dev0",
172172
"flask-appbuilder==4.5.2",
173173
"flask-login>=0.6.2",
174-
"flask>=2.2,<2.3",
174+
"flask>=2.2,<3",
175175
"google-re2>=1.0",
176176
"jmespath>=0.7.0",
177177
""",
@@ -184,7 +184,7 @@ def test_find_matching_long_package_name_bad_filter():
184184
"apache-airflow>=2.9.0b0",
185185
"flask-appbuilder==4.5.2",
186186
"flask-login>=0.6.2",
187-
"flask>=2.2,<2.3",
187+
"flask>=2.2,<3",
188188
"google-re2>=1.0",
189189
"jmespath>=0.7.0",
190190
""",

generated/provider_dependencies.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@
553553
"apache-airflow>=2.9.0",
554554
"flask-appbuilder==4.5.2",
555555
"flask-login>=0.6.2",
556-
"flask>=2.2,<2.3",
556+
"flask>=2.2,<3",
557557
"google-re2>=1.0",
558558
"jmespath>=0.7.0"
559559
],

hatch_build.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@
266266
"pytest-rerunfailures>=13.0",
267267
"pytest-timeouts>=1.2.1",
268268
"pytest-xdist>=3.5.0",
269-
"pytest>=8.2,<9",
269+
"pytest>=8.2,<8.3",
270270
"requests_mock>=1.11.0",
271271
"time-machine>=2.13.0",
272272
"wheel>=0.42.0",
@@ -422,7 +422,7 @@
422422
# The usage was added in #30596, seemingly only to override and improve the default error message.
423423
# Either revert that change or find another way, preferably without using connexion internals.
424424
# This limit can be removed after https://github.com/apache/airflow/issues/35234 is fixed
425-
"connexion[flask]>=2.14.2,<3.0",
425+
"connexion==2.15.0rc2",
426426
"cron-descriptor>=1.2.24",
427427
"croniter>=2.0.2",
428428
"cryptography>=41.0.0",
@@ -433,14 +433,9 @@
433433
# see https://github.com/pydantic/pydantic/issues/10958
434434
'eval-type-backport>=0.2.0;python_version<"3.10"',
435435
"flask-caching>=2.0.0",
436-
# Flask-Session 0.6 add new arguments into the SqlAlchemySessionInterface constructor as well as
437-
# all parameters now are mandatory which make AirflowDatabaseSessionInterface incompatible with this version.
438-
"flask-session>=0.4.0,<0.6",
436+
"flask-session>=0.8.0",
439437
"flask-wtf>=1.1.0",
440-
# Flask 2.3 is scheduled to introduce a number of deprecation removals - some of them might be breaking
441-
# for our dependencies - notably `_app_ctx_stack` and `_request_ctx_stack` removals.
442-
# We should remove the limitation after 2.3 is released and our dependencies are updated to handle it
443-
"flask>=2.2.1,<2.3",
438+
"flask>=2,<4",
444439
"fsspec>=2023.10.0",
445440
'google-re2>=1.0;python_version<"3.12"',
446441
'google-re2>=1.1;python_version>="3.12"',
@@ -494,9 +489,7 @@
494489
# Universal Pathlib 0.2.4 adds extra validation for Paths and our integration with local file paths
495490
# Does not work with it Tracked in https://github.com/fsspec/universal_pathlib/issues/276
496491
"universal-pathlib>=0.2.2,!=0.2.4",
497-
# Werkzug 3 breaks Flask-Login 0.6.2, also connexion needs to be updated to >= 3.0
498-
# we should remove this limitation when FAB supports Flask 2.3 and we migrate connexion to 3+
499-
"werkzeug>=2.0,<3",
492+
"werkzeug>=3,<4",
500493
]
501494

502495

0 commit comments

Comments
 (0)