This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-0-test by this push:
     new 20e1a2fe78e [v3-0-test] Add deprecation notice for using Connection 
from models (#53594) (#53621)
20e1a2fe78e is described below

commit 20e1a2fe78e9ac5b2d4d44b3fe9fcd3578439f3f
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Jul 22 15:14:04 2025 +0200

    [v3-0-test] Add deprecation notice for using Connection from models 
(#53594) (#53621)
    
    (cherry picked from commit 747a3e703aa46fb41297d052060122575a59e766)
    
    Co-authored-by: Amogh Desai <[email protected]>
---
 airflow-core/src/airflow/models/connection.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/airflow-core/src/airflow/models/connection.py 
b/airflow-core/src/airflow/models/connection.py
index 9205083c9d3..f3e6dbd5c01 100644
--- a/airflow-core/src/airflow/models/connection.py
+++ b/airflow-core/src/airflow/models/connection.py
@@ -21,6 +21,7 @@ import json
 import logging
 import re
 import sys
+import warnings
 from contextlib import suppress
 from json import JSONDecodeError
 from typing import Any
@@ -464,10 +465,15 @@ class Connection(Base, LoggingMixin):
         # If this is set it means are in some kind of execution context (Task, 
Dag Parse or Triggerer perhaps)
         # and should use the Task SDK API server path
         if hasattr(sys.modules.get("airflow.sdk.execution_time.task_runner"), 
"SUPERVISOR_COMMS"):
-            # TODO: AIP 72: Add deprecation here once we move this module to 
task sdk.
             from airflow.sdk import Connection as TaskSDKConnection
             from airflow.sdk.exceptions import AirflowRuntimeError, ErrorType
 
+            warnings.warn(
+                "Using Connection.get_connection_from_secrets from 
`airflow.models` is deprecated."
+                "Please use `from airflow.sdk import Connection` instead",
+                DeprecationWarning,
+                stacklevel=1,
+            )
             try:
                 conn = TaskSDKConnection.get(conn_id=conn_id)
                 if isinstance(conn, TaskSDKConnection):

Reply via email to