Get startedGet started for free

Schedule a Dag via Python

You've learned quite a bit about creating Dags, but now you would like to schedule a specific Dag on a specific day of the week at a certain time. You'd like the code to include this information in case a colleague needs to reinstall the Dag to a different server.

The Airflow dag object and the appropriate datetime methods have been imported for you.

This exercise is part of the course

Introduction to Apache Airflow in Python

View Course

Exercise instructions

  • Set the start date of the Dag to November 1, 2025.
  • Use the cron syntax to configure a schedule of every Wednesday at 12:30pm.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

@dag(
  dag_id='update_dataflows',
  # Set to November 1, 2025
  start_date=datetime(____),
  # Every Wednesday at 12:30pm
  schedule='____'
)
def update_dataflows():
  @task
  def pull_source_data():
    pass
  
update_dataflows()
Edit and Run Code