hsnprsd commented on a change in pull request #12376:
URL: https://github.com/apache/airflow/pull/12376#discussion_r523933522



##########
File path: airflow/example_dags/tutorial_etl_dag.py
##########
@@ -61,33 +61,35 @@
 
     # [START extract_function]
     def extract(**kwargs):
-        ti = kwargs['ti']
         data_string = '{"1001": 301.27, "1002": 433.21, "1003": 502.22}'
+
+        ti = kwargs['ti']
         ti.xcom_push('order_data', data_string)
 
     # [END extract_function]
 
     # [START transform_function]
-    def transform(**kwargs):
-        ti = kwargs['ti']
-        extract_data_string = ti.xcom_pull(task_ids='extract', 
key='order_data')
+    def transform(extract_data_string, **kwargs):
         order_data = json.loads(extract_data_string)
 
         total_order_value = 0
         for value in order_data.values():
             total_order_value += value
 
-        total_value = {"total_order_value": total_order_value}
-        total_value_json_string = json.dumps(total_value)
-        ti.xcom_push('total_order_value', total_value_json_string)
+        total_order_value_string = json.dumps(
+            {
+                "total_order_value": total_order_value,
+            }
+        )
+
+        ti = kwargs['ti']
+        ti.xcom_push('total_order_value', total_order_value_string)

Review comment:
       I reverted all changes in this file.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to