Creating a simple Dag
You've spent some time reviewing the Airflow components and are interested in testing out your own workflows. To start, you decide to define the default parameters and create a Dag object for your workflow.
The datetime object has been imported for you.
This exercise is part of the course
Introduction to Apache Airflow in Python
Exercise instructions
- Import the Airflow Dag object; note that it is case-sensitive.
- Define the Dag decorator and name the Dag
example_etl. - Run the Dag function at the end of the code file.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import the dag object
from ____ import dag
# Define the Dag attributes
____(
____='example_etl',
start_date=datetime(2026, 3, 1),
)
def example_etl():
pass
# Run the Dag
____()