This is an automated email from the ASF dual-hosted git repository.
potiuk 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 c36ce1b34bc Remove module-level import from `airflow.configuration`
(#63787)
c36ce1b34bc is described below
commit c36ce1b34bcdf1a994cf7ec002475c71a4034504
Author: Dev-iL <[email protected]>
AuthorDate: Thu Mar 19 12:47:45 2026 +0200
Remove module-level import from `airflow.configuration` (#63787)
Importing airflow.models.Connection pulled in airflow.configuration, and
airflow.configuration initializes secrets backends at import time. That
initialization itself does `from airflow.models import Connection`, so under
Python 3.14 the lazy import path could re-enter `airflow.models.__getattr__
before connection.py` had finished defining the Connection class. The result
was the ImportError: Module "airflow.models.connection" does not define a
"Connection"; plus repeated SQLAlchemy w [...]
---
airflow-core/src/airflow/models/connection.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/airflow-core/src/airflow/models/connection.py
b/airflow-core/src/airflow/models/connection.py
index 0e1505f4667..d58f2b3202d 100644
--- a/airflow-core/src/airflow/models/connection.py
+++ b/airflow-core/src/airflow/models/connection.py
@@ -32,7 +32,6 @@ from sqlalchemy.orm import Mapped, declared_attr,
mapped_column, reconstructor,
from airflow._shared.module_loading import import_string
from airflow._shared.secrets_masker import mask_secret
-from airflow.configuration import conf, ensure_secrets_loaded
from airflow.exceptions import AirflowException, AirflowNotFoundException
from airflow.models.base import ID_LEN, Base
from airflow.models.crypto import get_fernet
@@ -528,6 +527,8 @@ class Connection(Base, LoggingMixin):
raise AirflowNotFoundException(f"The conn_id `{conn_id}`
isn't defined") from None
raise
+ from airflow.configuration import conf, ensure_secrets_loaded
+
if team_name and not conf.getboolean("core", "multi_team"):
raise ValueError(
"Multi-team mode is not configured in the Airflow environment
but the task trying to access the connection belongs to a team"