title: Dynamic operators within DAGs
body: <p>I would like to know if what I did to achieve to goal of dynamic operators within an Airflow DAG is a good or a bad practice. </p>
  
  <blockquote>
    <p>The goal I had to achieve was to create a 'x' amount of operators within
    a DAG based on the result of an API call. This DAG will run every for example every week.</p>
  </blockquote>
  
  <p>The program that I made works, but I don't know if it is a good practice for developing DAGs for Airflow. So my question is: is it a good practice or if not what would be a better solution to this problem? </p>
  
  <p>The code I used to achieve this goal:</p>
  
  <pre><code>with DAG('my_dag', default_args=default_args, schedule_interval='@weekly') as my_dag:
  
      start = DummyOperator(
          task_id='start'
      )
  
      endpoint = 'www.example.com/api/dummies'
      r = requests.get(endpoint)
      dummies = r.json()
  
     for _, dummy in enumerate(dummies):
          dummy_operator = DummyOperator(
                      task_id='dummy_opr_{}'.format(dummy['id']
                      )
          start &gt;&gt; dummy_operator
  </code></pre>