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

gopidesu 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 8ed08ef7701 [v3-0-test] Fix connection retrieval in triggerer for 
schema field, use by_alias=True for ConnectionResult (#52673) (#52691)
8ed08ef7701 is described below

commit 8ed08ef770115e8fcfe650c5ca851a70d053f568
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Jul 2 10:01:25 2025 +0100

    [v3-0-test] Fix connection retrieval in triggerer for schema field, use 
by_alias=True for ConnectionResult (#52673) (#52691)
    
    * Fix connection retrieval in triggerer for schema field, use by_alias=True 
for ConnectionResult
    
    * Fix connection retrieval in triggerer for schema field, use by_alias=True 
for ConnectionResult
    (cherry picked from commit bb93415b6e814f6da18186d4fee07b37ce9a9064)
    
    Co-authored-by: GPK <[email protected]>
---
 .../src/airflow/jobs/triggerer_job_runner.py       |  3 ++-
 airflow-core/tests/unit/jobs/test_triggerer_job.py | 23 +++++++++++++++-------
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/airflow-core/src/airflow/jobs/triggerer_job_runner.py 
b/airflow-core/src/airflow/jobs/triggerer_job_runner.py
index adc87e802fa..8d2bdf99795 100644
--- a/airflow-core/src/airflow/jobs/triggerer_job_runner.py
+++ b/airflow-core/src/airflow/jobs/triggerer_job_runner.py
@@ -396,7 +396,8 @@ class TriggerRunnerSupervisor(WatchedSubprocess):
             if isinstance(conn, ConnectionResponse):
                 conn_result = ConnectionResult.from_conn_response(conn)
                 resp = conn_result
-                dump_opts = {"exclude_unset": True}
+                # `by_alias=True` is used to convert the `schema` field to 
`schema_` in the Connection model
+                dump_opts = {"exclude_unset": True, "by_alias": True}
             else:
                 resp = conn
         elif isinstance(msg, GetVariable):
diff --git a/airflow-core/tests/unit/jobs/test_triggerer_job.py 
b/airflow-core/tests/unit/jobs/test_triggerer_job.py
index d3cecb5fc94..08e08f08c4f 100644
--- a/airflow-core/tests/unit/jobs/test_triggerer_job.py
+++ b/airflow-core/tests/unit/jobs/test_triggerer_job.py
@@ -645,7 +645,16 @@ async def 
test_trigger_can_access_variables_connections_and_xcoms(session, dag_m
     task_instance.trigger_id = trigger_orm.id
 
     # Create the appropriate Connection, Variable and XCom
-    connection = Connection(conn_id="test_connection", conn_type="http")
+    connection = Connection(
+        conn_id="test_connection",
+        conn_type="http",
+        schema="https",
+        login="user",
+        password="pass",
+        extra={"key": "value"},
+        port=443,
+        host="example.com",
+    )
     variable = Variable(key="test_variable", val="some_variable_value")
     XComModel.set(
         key="test_xcom",
@@ -675,12 +684,12 @@ async def 
test_trigger_can_access_variables_connections_and_xcoms(session, dag_m
                 "conn_id": "test_connection",
                 "conn_type": "http",
                 "description": None,
-                "host": None,
-                "schema": None,
-                "login": None,
-                "password": None,
-                "port": None,
-                "extra": None,
+                "host": "example.com",
+                "schema": "https",
+                "login": "user",
+                "password": "pass",
+                "port": 443,
+                "extra": '{"key": "value"}',
             },
             "variable": "some_variable_value",
             "xcom": '"some_xcom_value"',

Reply via email to