airflow-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kyle Nickl <kgni...@gmail.com>
Subject xcom return_value returns as an item in an array?
Date Mon, 16 Aug 2021 20:44:14 GMT
So I run an operator that I name task1. It has an xcom return value. The
value is display as a string as I would expect. But when I go to my next
operator that does an xcom pull the value that gets passed in the in the
value in an array that I see when the operator prints the value like
['my_value] instead of just my_value. I've tried on two different operators
and same thing happens on both each time.

But then whe I tried with a python operator using context inside the code
like context['ti'].xcom_pull(task_ids='task1', key='return_value') the
value is retrieved as expected and not in an array. Which surprised me.

Any ideas on this or how I should properly retrieve this value when I'm
trying to take the return_value and directly pass it in as a parameter
value on another operator?

Example (if the xcom return value is my_value the value the operator gets
is ['my_value']:
retrieveAndDisplayTokenOneWay = TestOperator(
    task_id='task2',
    something="{{ ti.xcom_pull(task_ids=['task1'],key='return_value')}}"

Thanks!

Mime
View raw message