Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion airflow-core/src/airflow/cli/commands/connection_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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."""
Expand Down Expand Up @@ -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."""
Expand All @@ -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."""
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from airflow.cli.commands import (
asset_command,
config_command,
connection_command,
dag_command,
pool_command,
provider_command,
Expand All @@ -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"),
Expand Down