josix commented on code in PR #56827:
URL: https://github.com/apache/airflow/pull/56827#discussion_r2460962446
##########
providers/fab/src/airflow/providers/fab/auth_manager/models/__init__.py:
##########
@@ -45,20 +43,21 @@
from airflow.api_fastapi.auth.managers.models.base_user import BaseUser
try:
- from sqlalchemy.orm import mapped_column
+ from sqlalchemy.orm import mapped_column as _mapped_column
+
+ IS_SQLALCHEMY_2 = True
except ImportError:
# fallback for SQLAlchemy < 2.0
- def mapped_column(*args, **kwargs):
+ IS_SQLALCHEMY_2 = False
+
+ def _fallback_mapped_column(*args, **kwargs):
from sqlalchemy import Column
return Column(*args, **kwargs)
-if TYPE_CHECKING:
- try:
- from sqlalchemy import Identity
- except Exception:
- Identity = None
+mapped_column = _mapped_column if IS_SQLALCHEMY_2 else _fallback_mapped_column
Review Comment:
Thanks, I've updated the change.
--
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]