How to Solve NameError: name 'DAG' is not defined -- airflow

Solution: Import the 'DAG' module

# Add the following line to the top of your code
from airflow import DAG

 

For more information:
airflow DAG