Reputation: 525
Is there any difference between from airflow import DAG
(used in the tutorial in the docs) and from airflow.models import DAG
(used in the example DAGs)?
I'm new to Airflow and unsure if they should be used differently.
Upvotes: 5
Views: 2070
Reputation: 11627
Is there any difference?
No
Looking at the source code, following should behave identical
from airflow.models.dag import DAG
: this is the full-qualified import for the dag.py
module
from airflow.models import DAG
: this works the same as because DAG
has been imported in __init__.py
of models
package
from airflow import DAG
: this also works because DAG
is made available in __init__.py
of airflow
Upvotes: 8