diff --git a/airflow-core/src/airflow/config_templates/config.yml b/airflow-core/src/airflow/config_templates/config.yml index 545cded21d71d..af11f9fe701d1 100644 --- a/airflow-core/src/airflow/config_templates/config.yml +++ b/airflow-core/src/airflow/config_templates/config.yml @@ -683,7 +683,7 @@ database: Check connection at the start of each connection pool checkout. Typically, this is a simple statement like "SELECT 1". See `SQLAlchemy Pooling: Disconnect Handling - Pessimistic - `__ + `__ for more details. version_added: 2.3.0 type: boolean diff --git a/airflow-core/src/airflow/utils/db.py b/airflow-core/src/airflow/utils/db.py index ce4ef036d20fd..ea02c10f24644 100644 --- a/airflow-core/src/airflow/utils/db.py +++ b/airflow-core/src/airflow/utils/db.py @@ -90,8 +90,10 @@ from airflow.models.connection import Connection from airflow.typing_compat import Self - # TODO: Import this from sqlalchemy.orm instead when switching to SQLA 2. - # https://docs.sqlalchemy.org/en/20/orm/mapping_api.html#sqlalchemy.orm.MappedClassProtocol + # Note: SQLAlchemy 2.x (already required by this package) ships its own + # sqlalchemy.orm.MappedClassProtocol, but it checks for __table__/__mapper__/__call__ + # rather than __tablename__, so it isn't a drop-in replacement for this local protocol. + # See https://docs.sqlalchemy.org/en/20/orm/mapping_api.html#sqlalchemy.orm.MappedClassProtocol class MappedClassProtocol(Protocol): """Protocol for SQLALchemy model base.""" diff --git a/airflow-core/tests/unit/utils/test_orm_event_handlers.py b/airflow-core/tests/unit/utils/test_orm_event_handlers.py index 0b670c6566238..da2b202a315f9 100644 --- a/airflow-core/tests/unit/utils/test_orm_event_handlers.py +++ b/airflow-core/tests/unit/utils/test_orm_event_handlers.py @@ -17,7 +17,7 @@ """ These tests ensure compatibility with the deprecation of `sqlalchemy.orm.mapper()` in SQLAlchemy 2.0.0.b1. -See also: https://docs.sqlalchemy.org/en/21/orm/mapping_styles.html#orm-imperative-mapping +See also: https://docs.sqlalchemy.org/en/20/orm/mapping_styles.html#orm-imperative-mapping """ from __future__ import annotations