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

uranusjr 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 2c2ddf4b055 refactor: Update CLI parameter from `--exec-date` to 
`--logical-date` (#48458)
2c2ddf4b055 is described below

commit 2c2ddf4b055b8847aaf661dccddf70e562e8e8b2
Author: Amar Prakash Pandey <[email protected]>
AuthorDate: Tue Apr 1 00:37:40 2025 +0530

    refactor: Update CLI parameter from `--exec-date` to `--logical-date` 
(#48458)
    
    * refactor: Update CLI parameter from `--exec-date` to `--logical-date`
    
    Update the documentation to use `--logical-date` instead of the deprecated
    `--exec-date` parameter in the `airflow dags trigger` command examples.
    
    * doc: add newsfragment for --exec-date change
    
    * docs: updated the newsfragment for --exec change
---
 airflow-core/docs/core-concepts/dag-run.rst              |  2 +-
 airflow-core/newsfragments/48458.significant.rst         | 14 ++++++++++++++
 airflow-core/src/airflow/cli/cli_config.py               |  5 ++---
 airflow-core/src/airflow/cli/commands/dag_command.py     |  2 +-
 airflow-core/tests/unit/cli/commands/test_dag_command.py |  2 +-
 5 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/airflow-core/docs/core-concepts/dag-run.rst 
b/airflow-core/docs/core-concepts/dag-run.rst
index 922b87ccb69..7882fc94c65 100644
--- a/airflow-core/docs/core-concepts/dag-run.rst
+++ b/airflow-core/docs/core-concepts/dag-run.rst
@@ -219,7 +219,7 @@ Note that DAG Runs can also be created manually through the 
CLI. Just run the co
 
 .. code-block:: bash
 
-    airflow dags trigger --exec-date logical_date run_id
+    airflow dags trigger --logical-date logical_date run_id
 
 The DAG Runs created externally to the scheduler get associated with the 
trigger's timestamp and are displayed
 in the UI alongside scheduled DAG runs. The logical date passed inside the DAG 
can be specified using the ``-e`` argument.
diff --git a/airflow-core/newsfragments/48458.significant.rst 
b/airflow-core/newsfragments/48458.significant.rst
new file mode 100644
index 00000000000..1f834d4395b
--- /dev/null
+++ b/airflow-core/newsfragments/48458.significant.rst
@@ -0,0 +1,14 @@
+For the Airflow CLI, we have changed the CLI parameter ``--exec-date`` to 
``--logical-date`` for the command ``airflow dags trigger`` to maintain 
consistency with Airflow 3.0 and above.
+
+This is a breaking change for users using the ``airflow dags trigger`` command 
with the ``--exec-date`` parameter in their scripts or workflows.
+
+* Types of change
+
+  * [ ] Dag changes
+  * [ ] Config changes
+  * [ ] API changes
+  * [x] CLI changes
+  * [ ] Behaviour changes
+  * [ ] Plugin changes
+  * [ ] Dependency changes
+  * [ ] Code interface changes
diff --git a/airflow-core/src/airflow/cli/cli_config.py 
b/airflow-core/src/airflow/cli/cli_config.py
index ee34d083ab5..3d7a3de5293 100644
--- a/airflow-core/src/airflow/cli/cli_config.py
+++ b/airflow-core/src/airflow/cli/cli_config.py
@@ -144,7 +144,7 @@ def string_lower_type(val):
 # Shared
 ARG_DAG_ID = Arg(("dag_id",), help="The id of the dag")
 ARG_TASK_ID = Arg(("task_id",), help="The id of the task")
-ARG_LOGICAL_DATE = Arg(("logical_date",), help="The logical date of the DAG", 
type=parsedate)
+ARG_LOGICAL_DATE = Arg(("-l", "--logical-date"), help="The logical date of the 
DAG", type=parsedate)
 ARG_LOGICAL_DATE_OPTIONAL = Arg(
     ("logical_date",), nargs="?", help="The logical date of the DAG 
(optional)", type=parsedate
 )
@@ -420,7 +420,6 @@ ARG_IMGCAT = Arg(("--imgcat",), help="Displays graph using 
the imgcat tool.", ac
 # trigger_dag
 ARG_RUN_ID = Arg(("-r", "--run-id"), help="Helps to identify this run")
 ARG_CONF = Arg(("-c", "--conf"), help="JSON string that gets pickled into the 
DagRun's conf attribute")
-ARG_EXEC_DATE = Arg(("-e", "--exec-date"), help="The logical date of the DAG", 
type=parsedate)
 ARG_REPLACE_MICRO = Arg(
     ("--no-replace-microseconds",),
     help="whether microseconds should be zeroed",
@@ -1026,7 +1025,7 @@ DAGS_COMMANDS = (
             ARG_DAG_ID,
             ARG_RUN_ID,
             ARG_CONF,
-            ARG_EXEC_DATE,
+            ARG_LOGICAL_DATE,
             ARG_VERBOSE,
             ARG_REPLACE_MICRO,
             ARG_OUTPUT,
diff --git a/airflow-core/src/airflow/cli/commands/dag_command.py 
b/airflow-core/src/airflow/cli/commands/dag_command.py
index 2d038282000..9bff688a41b 100644
--- a/airflow-core/src/airflow/cli/commands/dag_command.py
+++ b/airflow-core/src/airflow/cli/commands/dag_command.py
@@ -133,7 +133,7 @@ def dag_trigger(args) -> None:
             dag_id=args.dag_id,
             run_id=args.run_id,
             conf=args.conf,
-            logical_date=args.exec_date,
+            logical_date=args.logical_date,
             replace_microseconds=args.replace_microseconds,
         )
         AirflowConsole().print_as(
diff --git a/airflow-core/tests/unit/cli/commands/test_dag_command.py 
b/airflow-core/tests/unit/cli/commands/test_dag_command.py
index 33d33fac5bd..77944cbc2a2 100644
--- a/airflow-core/tests/unit/cli/commands/test_dag_command.py
+++ b/airflow-core/tests/unit/cli/commands/test_dag_command.py
@@ -474,7 +474,7 @@ class TestCliDags:
                     "trigger",
                     "example_bash_operator",
                     "--run-id=test_trigger_dag_with_micro",
-                    "--exec-date=2021-06-04T09:00:00.000001+08:00",
+                    "--logical-date=2021-06-04T09:00:00.000001+08:00",
                     "--no-replace-microseconds",
                 ],
             )

Reply via email to