This is an automated email from the ASF dual-hosted git repository.
vincbeck pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 23a4d8f5688 refactor: migrate models to use mapped_column for
SQLAlchemy 2.0 compatibility (#56827)
23a4d8f5688 is described below
commit 23a4d8f5688ee8f5960f0df7e4978c9cd88b3e5f
Author: Josix <[email protected]>
AuthorDate: Fri Oct 24 23:27:31 2025 +0800
refactor: migrate models to use mapped_column for SQLAlchemy 2.0
compatibility (#56827)
* refactor: migrate models to use mapped_column for SQLAlchemy 2.0
compatibility
* fixup! refactor: migrate models to use mapped_column for SQLAlchemy 2.0
compatibility
---
.../fab/src/airflow/providers/fab/auth_manager/models/__init__.py | 8 --------
.../fab/tests/unit/fab/auth_manager/models/test_user_model.py | 7 ++-----
2 files changed, 2 insertions(+), 13 deletions(-)
diff --git
a/providers/fab/src/airflow/providers/fab/auth_manager/models/__init__.py
b/providers/fab/src/airflow/providers/fab/auth_manager/models/__init__.py
index 375a8a6d952..1acc7568040 100644
--- a/providers/fab/src/airflow/providers/fab/auth_manager/models/__init__.py
+++ b/providers/fab/src/airflow/providers/fab/auth_manager/models/__init__.py
@@ -21,8 +21,6 @@ import datetime
# This product contains a modified portion of 'Flask App Builder' developed by
Daniel Vaz Gaspar.
# (https://github.com/dpgaspar/Flask-AppBuilder).
# Copyright 2013, Daniel Vaz Gaspar
-from typing import TYPE_CHECKING
-
from flask import current_app, g
from flask_appbuilder import Model
from sqlalchemy import (
@@ -45,12 +43,6 @@ from sqlalchemy.orm import Mapped, backref, declared_attr,
relationship
from airflow.api_fastapi.auth.managers.models.base_user import BaseUser
from airflow.providers.common.compat.sqlalchemy.orm import mapped_column
-if TYPE_CHECKING:
- try:
- from sqlalchemy import Identity
- except Exception:
- Identity = None
-
"""
Compatibility note: The models in this file are duplicated from Flask
AppBuilder.
"""
diff --git
a/providers/fab/tests/unit/fab/auth_manager/models/test_user_model.py
b/providers/fab/tests/unit/fab/auth_manager/models/test_user_model.py
index 051e39cd053..ba549e9b55e 100644
--- a/providers/fab/tests/unit/fab/auth_manager/models/test_user_model.py
+++ b/providers/fab/tests/unit/fab/auth_manager/models/test_user_model.py
@@ -25,12 +25,9 @@ pytestmark = pytest.mark.db_test
@pytest.mark.parametrize(
"user_id, expected_id",
- [
- (999, "999"),
- ("999", "999"),
- ],
+ [(999, "999")],
)
-def test_get_id_returns_str(user_id: int | str, expected_id: str) -> None:
+def test_get_id_returns_str(user_id: int, expected_id: str) -> None:
"""
Ensure get_id() always returns a string representation of the id.
"""