From 0b5c2c1e9232f7d89a209bf76d6ab679d6efe314 Mon Sep 17 00:00:00 2001 From: Anshu Singh Date: Thu, 4 Dec 2025 16:41:19 +0530 Subject: [PATCH] Fix: Usage: airflow connections test [-h] [-v] conn_id Test a connection Positional Arguments: conn_id Connection id, required to get/add/delete/test a connection Options: -h, --help show this help message and exit -v, --verbose Make logging output more verbose fails to resolve connection by conn_id --- airflow-core/src/airflow/cli/commands/connection_command.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/airflow-core/src/airflow/cli/commands/connection_command.py b/airflow-core/src/airflow/cli/commands/connection_command.py index 7fe430c05bfe3..9e8ab7c43cd4d 100644 --- a/airflow-core/src/airflow/cli/commands/connection_command.py +++ b/airflow-core/src/airflow/cli/commands/connection_command.py @@ -367,9 +367,15 @@ def connections_test(args) -> None: raise SystemExit(1) print(f"Retrieving connection: {args.conn_id!r}") + conn = None try: conn = Connection.get_connection_from_secrets(args.conn_id) except AirflowNotFoundException: + pass + if conn is None: + with create_session() as session: + conn = session.scalar(select(Connection).where(Connection.conn_id == args.conn_id)) + if conn is None: console.print("[bold yellow]\nConnection not found.\n") raise SystemExit(1)