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.


with DAG(…) as dag:

EmailOperator(subject=dag.param(‘subject’, ‘Hi from Airflow!’))

  • 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.

resolve(self, context: Dict)[source]

Pull DagParam value from DagRun context. This method is run during op.execute().

Was this entry helpful?