uranusjr commented on code in PR #25711:
URL: https://github.com/apache/airflow/pull/25711#discussion_r963959580


##########
docs/apache-airflow/concepts/operators.rst:
##########
@@ -127,12 +132,12 @@ Deep nested fields can also be substituted, as long as 
all intermediate fields a
         # [additional code here...]
 
 
-    t = PythonOperator(
-        task_id="transform_data",
-        python_callable=transform_data,
-        op_args=[MyDataTransformer(MyDataReader("/tmp/{{ ds }}/my_file"))],
-        dag=dag,
-    )
+    @task(task_id="transform_data")
+    def transform_data(data_transformer):
+        pass
+
+
+    t = transform_data([MyDataTransformer(MyDataReader("/tmp/{{ ds 
}}/my_file"))])

Review Comment:
   I don’t think this works, XComArg inputs are not automatically processed in 
taskflow.
   
   This needs to be implemented as
   
   ```python
   @task(task_id="transform_data")
   def transform_data(ds=None):
       MyDataTransformer(MyDataReader("/tmp/{ds}/my_file"))
   ```
   
   but this would make the section above meaningless. So a better way would be 
to use another operator altogether, not `PythonOperator`, for the example.



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to