I need to use the output from oracleOperator in another task for further execution. The trouble I have is that when I pull the data into another task and print it, it gives a result as None. There is no error thrown but the data isn't passed through. Also, the xcom tab in task UI shows blank for keys and values.
My code is as follows:
from airflow import DAG
from airflow.operators.oracle_operator import OracleOperator
from airflow.operators.python_operator import PythonOperator
from airflow.utils.dates import days_ago
args = {
'owner': 'xyz',
'start_date': days_ago(2),
}
dag = DAG('example_xcom', schedule_interval="@once", default_args=args, tags=['example'])
def puller(**kwargs):
ti = kwargs['ti']
# get value_1
pulled_value_1 = ti.xcom_pull(key=None, task_ids='push')
print("VALUE IN PULLER ")
print(pulled_value_1)
pull = PythonOperator(
task_id='pullee',
dag=dag,
python_callable=puller,
provide_context=True,
)
push = OracleOperator(
task_id='data',
sql='SELECT * FROM CUSTOMERS',
oracle_conn_id='1',
provide_context=True,
dag=dag,
)
push>>pull