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

kaxilnaik 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 3cc4e47d7ea Remove redundant --conn-id flag from `airflow connections 
list` (#59855)
3cc4e47d7ea is described below

commit 3cc4e47d7eaeb353a800a5dba58c2fcb11e5944f
Author: SMR <[email protected]>
AuthorDate: Mon Dec 29 20:39:16 2025 +0530

    Remove redundant --conn-id flag from `airflow connections list` (#59855)
    
    The --conn-id filter in 'airflow connections list' is redundant with
    'airflow connections get'. Users should use 'get' when they know the
    specific connection ID they want.
    
    Changes:
    - Removed ARG_CONN_ID_FILTER argument definition
    - Removed --conn-id from connections list command args
    - Removed filtering logic from connections_list() function
    - Removed test for --conn-id filtering
    
    Fixes #59846
    
    Co-authored-by: Jarek Potiuk <[email protected]>
    Co-authored-by: Kaxil Naik <[email protected]>
---
 airflow-core/newsfragments/59855.significant.rst                | 1 +
 airflow-core/src/airflow/cli/cli_config.py                      | 5 +----
 airflow-core/src/airflow/cli/commands/connection_command.py     | 5 +----
 airflow-core/tests/unit/cli/commands/test_connection_command.py | 9 ---------
 4 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/airflow-core/newsfragments/59855.significant.rst 
b/airflow-core/newsfragments/59855.significant.rst
new file mode 100644
index 00000000000..94507ca9e3c
--- /dev/null
+++ b/airflow-core/newsfragments/59855.significant.rst
@@ -0,0 +1 @@
+Removed the redundant ``--conn-id`` option from the ``airflow connections 
list`` CLI command. Use ``airflow connections get`` instead.
diff --git a/airflow-core/src/airflow/cli/cli_config.py 
b/airflow-core/src/airflow/cli/cli_config.py
index 973d6ba0db6..3eacfa8e11d 100644
--- a/airflow-core/src/airflow/cli/cli_config.py
+++ b/airflow-core/src/airflow/cli/cli_config.py
@@ -721,9 +721,6 @@ ARG_ENV_VARS = Arg(
 
 # connections
 ARG_CONN_ID = Arg(("conn_id",), help="Connection id, required to 
get/add/delete/test a connection", type=str)
-ARG_CONN_ID_FILTER = Arg(
-    ("--conn-id",), help="If passed, only items with the specified connection 
ID will be displayed", type=str
-)
 ARG_CONN_URI = Arg(
     ("--conn-uri",), help="Connection URI, required to add a connection 
without conn_type", type=str
 )
@@ -1543,7 +1540,7 @@ CONNECTIONS_COMMANDS = (
         name="list",
         help="List connections",
         
func=lazy_load_command("airflow.cli.commands.connection_command.connections_list"),
-        args=(ARG_OUTPUT, ARG_VERBOSE, ARG_CONN_ID_FILTER),
+        args=(ARG_OUTPUT, ARG_VERBOSE),
     ),
     ActionCommand(
         name="add",
diff --git a/airflow-core/src/airflow/cli/commands/connection_command.py 
b/airflow-core/src/airflow/cli/commands/connection_command.py
index 6cf4378c42a..7ce4e60b248 100644
--- a/airflow-core/src/airflow/cli/commands/connection_command.py
+++ b/airflow-core/src/airflow/cli/commands/connection_command.py
@@ -84,10 +84,7 @@ def connections_list(args):
     """List all connections at the command line."""
     with create_session() as session:
         query = select(Connection)
-        if args.conn_id:
-            query = query.where(Connection.conn_id == args.conn_id)
-        query = session.scalars(query)
-        conns = query.all()
+        conns = session.scalars(query).all()
 
         AirflowConsole().print_as(
             data=conns,
diff --git a/airflow-core/tests/unit/cli/commands/test_connection_command.py 
b/airflow-core/tests/unit/cli/commands/test_connection_command.py
index 920bbfa1e2d..8a931d5efa5 100644
--- a/airflow-core/tests/unit/cli/commands/test_connection_command.py
+++ b/airflow-core/tests/unit/cli/commands/test_connection_command.py
@@ -94,15 +94,6 @@ class TestCliListConnections:
             assert conn_type in stdout
             assert conn_id in stdout
 
-    def test_cli_connections_filter_conn_id(self):
-        args = self.parser.parse_args(
-            ["connections", "list", "--output", "json", "--conn-id", 
"http_default"]
-        )
-        with redirect_stdout(StringIO()) as capture:
-            connection_command.connections_list(args)
-            stdout = capture.getvalue()
-        assert "http_default" in stdout
-
 
 class TestCliExportConnections:
     parser = cli_parser.get_parser()

Reply via email to