Get startedGet started for free

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() - Returns order_data
  • transform(order_data) - Returns summarized data
  • load(summary_data) - Does not return XCom information
  • send_report() - A non-XCom task that handles notifications

This exercise is part of the course

Introduction to Apache Airflow in Python

View Course

Exercise instructions

  • Insert the transform task between extract() and load() to complete the chain.
  • Assign the result to a variable called etl_result.
  • Set send_report to run after the etl_result variable.

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()
Edit and Run Code