airflow.models.dagparam
¶
Module Contents¶
-
class
airflow.models.dagparam.
DagParam
(current_dag, name: str, default: Optional[Any] = None)[source]¶ Class that represents a DAG run parameter.
It can be used to parameterize your dags. You can overwrite its value by setting it on conf when you trigger your DagRun.
This can also be used in templates by accessing {{context.params}} dictionary.
Example:
- with DAG(…) as dag:
EmailOperator(subject=dag.param(‘subject’, ‘Hi from Airflow!’))
- Parameters
current_dag (airflow.models.DAG) – Dag being used for parameter.
name (str) – key value which is used to set the parameter
default (Any) – Default value used if no parameter was set.