By following best practices and using XCom judiciously, you can unlock the full potential of Airflow and build more efficient, scalable, and reliable workflows. So, go ahead and experiment with Airflow XCom exclusive – your workflows will thank you!

@task def load(transformed: dict): print(f"Saving: transformed['result']") # no need to pull — Airflow passes XCom automatically

def try_claim(session, claim_id, worker_id): row = session.execute(update(claim_xcom) .where(claim_xcom.c.id==claim_id) .where(claim_xcom.c.status=='available') .values(status='claimed', claimed_by=worker_id, claimed_at=func.now()) .returning(claim_xcom)).first() return row # None if already claimed

Push only once, never overwrite a key. Use execution_date + task_id as part of the key. Enable exclusive mode to prevent accidental re-push.