You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/03/03 16:29:28 UTC

[GitHub] [airflow] msb217 commented on a change in pull request #7596: [AIRFLOW-6870] [WIP] remove imports from models/__init__.py

msb217 commented on a change in pull request #7596: [AIRFLOW-6870] [WIP] remove imports from models/__init__.py
URL: https://github.com/apache/airflow/pull/7596#discussion_r387134095
 
 

 ##########
 File path: airflow/utils/db.py
 ##########
 @@ -540,6 +537,11 @@ def resetdb():
     """
     Clear out the database
     """
+    from airflow.models.all_models import (  # noqa: F401 # pylint: disable=unused-import
+        DAG, XCOM_RETURN_KEY, BaseOperator, BaseOperatorLink, BaseJob, Connection, DagBag,
+        DagModel, DagPickle, DagRun, DagTag, Log, Pool, SerializedDagModel, SkipMixin, SlaMiss,
+        TaskFail, TaskInstance, TaskReschedule, Variable, XCom
+    )
 
 Review comment:
   @potiuk I would have placed `from airflow.models.all_models import *` as a local import as you specified, however, `import *` is only allowed at the module level in python. Therefore, I had to specify all model names individually.
   
   I could wrap this into some kind of `load_models` helper function so it's a bit cleaner

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services