来源[https://airflow.apache.org/code.html?highlight=ds_nodash#api-reference](https://airflow.apache.org/code.html?highlight=ds_nodash#api-reference)
Default Variables
Variable | Description |
---|---|
{{ ds }} |
the execution date as YYYY-MM-DD |
{{ ds_nodash }} |
the execution date as YYYYMMDD |
{{ yesterday_ds }} |
yesterday’s date as YYYY-MM-DD |
{{ yesterday_ds_nodash }} |
yesterday’s date as YYYYMMDD |
{{ tomorrow_ds }} |
tomorrow’s date as YYYY-MM-DD |
{{ tomorrow_ds_nodash }} |
tomorrow’s date as YYYYMMDD |
{{ ts }} |
same as execution_date.isoformat() |
{{ ts_nodash }} |
same as ts without - and : |
{{ execution_date }} |
the execution_date, (datetime.datetime) |
{{ prev_execution_date }} |
the previous execution date (if available) (datetime.datetime) |
{{ next_execution_date }} |
the next execution date (datetime.datetime) |
{{ dag }} |
the DAG object |
{{ task }} |
the Task object |
{{ macros }} |
a reference to the macros package, described below |
{{ task_instance }} |
the task_instance object |
{{ end_date }} |
same as {{ ds }} |
{{ latest_date }} |
same as {{ ds }} |
{{ ti }} |
same as {{ task_instance }} |
{{ params }} |
a reference to the user-defined params dictionary |
{{ var.value.my_var }} |
global defined variables represented as a dictionary |
|
global defined variables represented as a dictionary with deserialized JSON object, append the path to the key within the JSON object |
|
a unique, human-readable key to the task instance formatted |
|
the full configuration object located at |
{{ run_id }} |
the run_id of the current DAG run |
{{ dag_run }} |
a reference to the DagRun object |
|
whether the task instance was called using the CLI’s test subcommand |
Macros
Variable | Description |
---|---|
macros.datetime |
The standard lib’s datetime.datetime |
macros.timedelta |
|
macros.dateutil |
A reference to the dateutil package |
macros.time |
The standard lib’s time |
macros.uuid |
The standard lib’s uuid |
macros.random |
The standard lib’s random |