Skip to content

Default start_date and schedule_interval to None #24842

@BasPH

Description

@BasPH

Description

I suggest changing the bare-minimum code required for instantiating a DAG:

# Proposed

from airflow import DAG
from airflow.operators.bash import BashOperator

with DAG(dag_id="no_schedule_dag") as dag:
    BashOperator(task_id="foobar", bash_command="echo hello")

This is currently not possible because start_date is a required argument:
image

I regularly see people using externally triggered DAGs and you're currently forced to set a placeholder start_date because Airflow requires it:

# Current situation

import datetime

from airflow import DAG
from airflow.operators.bash import BashOperator

with DAG(dag_id="no_schedule_dag", start_date=datetime.datetime(2022, 1, 1), schedule_interval=None) as dag:
    BashOperator(task_id="foobar", bash_command="echo hello")

When people want to set a schedule_interval, they intentionally think of it, so defaulting to None feels like a better UX to me.

Use case/motivation

To improve the Airflow user experience, I suggest removing the start_date requirement on DAG:

DAG(dag_id="my_dag")

This DAG could be triggered externally.

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Labels

airflow3.0:breakingCandidates for Airflow 3.0 that contain breaking changesairflow3.0:candidatePotential candidates for Airflow 3.0kind:featureFeature Requests

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions