From a2430644add8e5777e511e93662075b5f85753c6 Mon Sep 17 00:00:00 2001 From: Yuseok Jo Date: Sun, 5 Jul 2026 18:58:13 +0900 Subject: [PATCH] [v3-3-test] [AIP-94] Mark connections commands as migrated to airflowctl (#68972) (cherry picked from commit cf2806199fe07c5cab7c8287ab06dd1fbca83517) Co-authored-by: Yuseok Jo --- .../src/airflow/cli/commands/connection_command.py | 13 ++++++++++++- .../unit/cli/commands/test_command_deprecations.py | 7 +++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/airflow-core/src/airflow/cli/commands/connection_command.py b/airflow-core/src/airflow/cli/commands/connection_command.py index 8911bc80b99e2..ce87af7a9c374 100644 --- a/airflow-core/src/airflow/cli/commands/connection_command.py +++ b/airflow-core/src/airflow/cli/commands/connection_command.py @@ -30,7 +30,12 @@ from sqlalchemy.orm import exc from airflow.cli.simple_table import AirflowConsole -from airflow.cli.utils import SENSITIVE_PLACEHOLDER, is_stdout, print_export_output +from airflow.cli.utils import ( + SENSITIVE_PLACEHOLDER, + deprecated_for_airflowctl, + is_stdout, + print_export_output, +) from airflow.configuration import conf from airflow.exceptions import AirflowNotFoundException from airflow.models import Connection @@ -140,6 +145,7 @@ def connections_get(args): ) +@deprecated_for_airflowctl("airflowctl connections list") @suppress_logs_and_warning @providers_configuration_loaded def connections_list(args): @@ -186,6 +192,7 @@ def _connection_to_dict(conn: Connection) -> dict: } +@deprecated_for_airflowctl("airflowctl connections create-defaults") def create_default_connections(args): db_create_default_connections() @@ -283,6 +290,7 @@ def connections_export(args): @cli_utils.action_cli +@deprecated_for_airflowctl("airflowctl connections create") @providers_configuration_loaded def connections_add(args): """Add new connection.""" @@ -379,6 +387,7 @@ def connections_add(args): @cli_utils.action_cli +@deprecated_for_airflowctl("airflowctl connections delete") @providers_configuration_loaded def connections_delete(args): """Delete connection from DB.""" @@ -395,6 +404,7 @@ def connections_delete(args): @cli_utils.action_cli(check_db=False) +@deprecated_for_airflowctl("airflowctl connections import") @providers_configuration_loaded def connections_import(args): """Import connections from a file.""" @@ -433,6 +443,7 @@ def _import_helper(file_path: str, overwrite: bool) -> None: print(f"Imported connection {conn_id}") +@deprecated_for_airflowctl("airflowctl connections test") @suppress_logs_and_warning @providers_configuration_loaded def connections_test(args) -> None: diff --git a/airflow-core/tests/unit/cli/commands/test_command_deprecations.py b/airflow-core/tests/unit/cli/commands/test_command_deprecations.py index 411cb6a84f14e..0eb13a0f09a13 100644 --- a/airflow-core/tests/unit/cli/commands/test_command_deprecations.py +++ b/airflow-core/tests/unit/cli/commands/test_command_deprecations.py @@ -33,6 +33,7 @@ from airflow.cli.commands import ( asset_command, config_command, + connection_command, dag_command, pool_command, provider_command, @@ -41,6 +42,12 @@ # (command callable, expected airflowctl replacement recorded by the decorator) MIGRATED_CLI_COMMANDS = [ + (connection_command.connections_list, "airflowctl connections list"), + (connection_command.connections_add, "airflowctl connections create"), + (connection_command.connections_delete, "airflowctl connections delete"), + (connection_command.connections_import, "airflowctl connections import"), + (connection_command.connections_test, "airflowctl connections test"), + (connection_command.create_default_connections, "airflowctl connections create-defaults"), (dag_command.dag_trigger, "airflowctl dags trigger"), (dag_command.dag_delete, "airflowctl dags delete"), (dag_command.dag_details, "airflowctl dags get-details"),