Skip to content

Commit 4acc955

Browse files
committed
refactor: migrate models to use mapped_column for SQLAlchemy 2.0 compatibility
1 parent 881c0a3 commit 4acc955

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

providers/fab/src/airflow/providers/fab/auth_manager/models/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
# This product contains a modified portion of 'Flask App Builder' developed by Daniel Vaz Gaspar.
2222
# (https://github.com/dpgaspar/Flask-AppBuilder).
2323
# Copyright 2013, Daniel Vaz Gaspar
24-
from typing import TYPE_CHECKING
25-
2624
from flask import current_app, g
2725
from flask_appbuilder import Model
2826
from sqlalchemy import (
@@ -45,12 +43,6 @@
4543
from airflow.api_fastapi.auth.managers.models.base_user import BaseUser
4644
from airflow.providers.common.compat.sqlalchemy.orm import mapped_column
4745

48-
if TYPE_CHECKING:
49-
try:
50-
from sqlalchemy import Identity
51-
except Exception:
52-
Identity = None
53-
5446
"""
5547
Compatibility note: The models in this file are duplicated from Flask AppBuilder.
5648
"""

providers/fab/tests/unit/fab/auth_manager/models/test_user_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_get_id_returns_str(user_id: int | str, expected_id: str) -> None:
3535
Ensure get_id() always returns a string representation of the id.
3636
"""
3737
user = User()
38-
user.id = user_id
38+
user.id = user_id # type: ignore[assignment] # id can be int or str for this test
3939
result = user.get_id()
4040
assert isinstance(result, str), f"Expected str, got {type(result)}"
4141
assert result == expected_id

0 commit comments

Comments
 (0)