Passing data with XCom
You're in the process of updating an ETL workflow to use an XCom to more easily keep track of information. As such, you need to update the dependencies between the tasks in your Dag.
You have four tasks defined already that are usable as follows:
extract()- Returnsorder_datatransform(order_data)- Returns summarized dataload(summary_data)- Does not return XCom informationsend_report()- A non-XCom task that handles notifications
This exercise is part of the course
Introduction to Apache Airflow in Python
Exercise instructions
- Insert the
transformtask betweenextract()andload()to complete the chain. - Assign the result to a variable called
etl_result. - Set
send_reportto run after theetl_resultvariable.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
@dag(start_date=datetime(2026,4,1))
def etl_example():
# Chain extract, transform, and load, assigning the result
____ = load(____(extract()))
# Run send_report after the ETL tasks
etl_result ____ ____()
etl_example()