resdevd edited a comment on issue #13823:
URL: https://github.com/apache/airflow/issues/13823#issuecomment-940466144


   @ashb Not sure if the dependencies are working even with specifying ">>". 
Below is a sample Taskflow dag with PostgresOperator.
   
   
   
   <img width="300" alt="Screen Shot 2021-10-11 at 1 43 19 PM" 
src="https://user-images.githubusercontent.com/29984943/136859434-8ea02532-6730-4c6f-88b4-e879b842b8cf.png";>
   
   This is the dag file where PostgresOperator seems out of the dependencies 
flow.
   
   ```import json
   from datetime import datetime
   from airflow.decorators import dag, task
   from airflow.providers.postgres.operators.postgres import PostgresOperator
   
   
   @dag(schedule_interval=None, start_date=datetime(2021, 10, 11), 
catchup=False, tags=['example'])
   def tutorial_taskflow_api_etl():
       test_pg_operator = PostgresOperator(
           task_id="test_pg_operator",
           postgres_conn_id="rd_master_pg",
           sql="SELECT 1;"
       )
   
       @task()
       def extract():
           data_string = '{"1001": 301.27, "1002": 433.21, "1003": 502.22}'
   
           order_data_dict = json.loads(data_string)
           return order_data_dict
   
       @task(multiple_outputs=True)
       def transform(order_data_dict: dict):
           total_order_value = 0
   
           for value in order_data_dict.values():
               total_order_value += value
   
           return {"total_order_value": total_order_value}
   
       #
       @task()
       def load(total_order_value: float):
           print(f"Total order value is: {total_order_value:.2f}")
   
       order_data = extract()
       order_summary = transform(order_data)
       load_task_flow = load(order_summary["total_order_value"])
       test_pg_operator >> load_task_flow
   
   
   tutorial_etl_dag = tutorial_taskflow_api_etl()```
   


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