Skip to content
Open
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
7 changes: 6 additions & 1 deletion airflow-core/src/airflow/cli/commands/variable_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from sqlalchemy import select

from airflow.cli.simple_table import AirflowConsole
from airflow.cli.utils import SENSITIVE_PLACEHOLDER, print_export_output
from airflow.cli.utils import SENSITIVE_PLACEHOLDER, deprecated_for_airflowctl, print_export_output
from airflow.exceptions import (
AirflowFileParseException,
AirflowUnsupportedFileTypeException,
Expand Down Expand Up @@ -63,6 +63,7 @@ def with_values(var, hide_sensitive: bool = False) -> dict[str, str]:
return {"key": key, "val": val}


@deprecated_for_airflowctl("airflowctl variables list")
@suppress_logs_and_warning
@providers_configuration_loaded
def variables_list(args):
Expand Down Expand Up @@ -92,6 +93,7 @@ def _mapper(var):
AirflowConsole().print_as(data=variables, output=args.output, mapper=None)


@deprecated_for_airflowctl("airflowctl variables get")
@suppress_logs_and_warning
@providers_configuration_loaded
def variables_get(args):
Expand All @@ -108,6 +110,7 @@ def variables_get(args):


@cli_utils.action_cli
@deprecated_for_airflowctl("airflowctl variables create")
@providers_configuration_loaded
def variables_set(args):
"""Create new variable with a given name, value and description."""
Expand All @@ -116,6 +119,7 @@ def variables_set(args):


@cli_utils.action_cli
@deprecated_for_airflowctl("airflowctl variables delete")
@providers_configuration_loaded
def variables_delete(args):
"""Delete variable by a given name."""
Expand All @@ -124,6 +128,7 @@ def variables_delete(args):


@cli_utils.action_cli
@deprecated_for_airflowctl("airflowctl variables import")
@providers_configuration_loaded
@provide_session
def variables_import(args, *, session: Session = NEW_SESSION):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

import pytest

from airflow.cli.commands import asset_command, dag_command, pool_command
from airflow.cli.commands import asset_command, dag_command, pool_command, variable_command

# (command callable, expected airflowctl replacement recorded by the decorator)
MIGRATED_CLI_COMMANDS = [
Expand All @@ -42,6 +42,11 @@
(pool_command.pool_delete, "airflowctl pools delete"),
(pool_command.pool_import, "airflowctl pools import"),
(pool_command.pool_export, "airflowctl pools export"),
(variable_command.variables_list, "airflowctl variables list"),
(variable_command.variables_get, "airflowctl variables get"),
(variable_command.variables_set, "airflowctl variables create"),
(variable_command.variables_delete, "airflowctl variables delete"),
(variable_command.variables_import, "airflowctl variables import"),
(asset_command.asset_materialize, "airflowctl assets materialize"),
]

Expand Down
Loading