How to create dynamic task mapping for postgres operator in airflow?

Viewed 18

I am completely new to AirFlow and I am trying to create 8 tasks which are pretty simillar.

I've read about expand() methond though I am not quite sure how to use it for PostgresOperator?

So I have this task:

t1 = PostgresOperator(
task_id='load_something_1',
postgres_conn_id="postgres_default",
sql = "SELECT somefunction_1()", 
dag=dag)

I need to create similar tasks only they gotta have load_something_2, load_something_3 etc. and SELECT somefucntion_2, SELECT somefucntion_3 etc.

How do I do this using dynamic task mapping ?

Thank you beforehand!

0 Answers
Related