I am having a dbt macro which is defined as follows :
As you can see, I am returning the result from the dbt macro.
`
{% macro return_hello() %}
{% set result = 'Hello, dbt!' %}
{{ return(result) }}
{% endmacro %}
`
I would want to fetch the values of the result variable (‘Hello,dbt!’) in airflow.
For running dbt macro from airflow , I am using dbtrunoperationoperator and have done xcom_push=True.
So when I am using
The task in dbtRunOperationOperator looks like :
`
def fetch_result(context):
ti=context['ti']
value=ti.xcom_pull(task_ids='dbt_task')
logging.info(value)
`
print_task=DbtRunOperationOperator(task_id=’dbt_task’,macro=’return_hello’,do_xcom_push=True)
print_task
Expections :
I was expecting that the ‘Hello,dbt!’ will be printed in the logs.
Actual Outcome :
The metadata json is being returned by the dbtRunOperationOperator.
Can anyone please help me figure out a solution for this ? Thanks in advance !!