Here's a simple example of how XCom works:
When we talk about Airflow XCom being "exclusive," we're referring to the fact that XCom is only accessible to tasks within the same DAG. This means that tasks in one DAG cannot access XCom values from another DAG. airflow xcom exclusive
task1 >> task2 In this example, task1 pushes a greeting message to XCom using xcom_push_key . task2 then pulls that message from XCom using xcom_pull and prints it. Here's a simple example of how XCom works:
Airflow XCom exclusive communication is a powerful feature that enables secure and flexible data sharing between tasks in a DAG. By understanding how XCom works and using it effectively, you can build more complex and dynamic workflows, while maintaining data integrity and security. Whether you're building data processing pipelines, machine learning workflows, or CI/CD pipelines, Airflow XCom exclusive is an essential tool to have in your toolkit. task2 then pulls that message from XCom using
task1 = BashOperator( task_id='task1', bash_command='echo "Hello, World!"', xcom_push_key='greeting', dag=dag, )