0

Is there any significance of adding '''# airflow''' as the first line in airflow dag. Because python will treat it as a comment.

  • can you give more details ? do you this comment ? did you see it in some docs ? – ozs Jul 04 '23 at 06:21

1 Answers1

0

TLDR; no, there is no significance. I would remove it to avoid any confusion.

I suspect you might have seen this somewhere on the internet, where the topic was around Airflow & DAG processing. Airflow uses a heuristic to discover files that potentially contain DAG objects: it checks if the words "airflow" and "DAG" exist in the file. I suspect adding "# airflow" might have been a workaround for Airflow to parse that script. However, in normal circumstances this should not be needed: if you have a DAG object in your script, you will need to import from airflow import DAG, which automatically makes Airflow parse that script, so an additional comment "# airflow" is therefore not needed.

Bas Harenslak
  • 2,591
  • 14
  • 14