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 2022/09/02 07:59:57 UTC

[GitHub] [airflow] uranusjr commented on a diff in pull request #25959: Ensure stale dataset references are removed

uranusjr commented on code in PR #25959:
URL: https://github.com/apache/airflow/pull/25959#discussion_r961396282


##########
airflow/models/dag.py:
##########
@@ -2561,12 +2560,16 @@ def bulk_write_to_db(cls, dags: Collection["DAG"], session=NEW_SESSION):
 
         dag_ids = set(dag_by_ids.keys())
         query = (
-            session.query(DagModel)
-            .options(joinedload(DagModel.tags, innerjoin=False))
-            .filter(DagModel.dag_id.in_(dag_ids))
+            (
+                session.query(DagModel)
+                .options(joinedload(DagModel.tags, innerjoin=False))
+                .filter(DagModel.dag_id.in_(dag_ids))
+            )
+            .options(joinedload(DagModel.schedule_dataset_references))
+            .options(joinedload(DagModel.task_outlet_dataset_references))

Review Comment:
   ```suggestion
               session.query(DagModel)
               .options(joinedload(DagModel.tags, innerjoin=False))
               .filter(DagModel.dag_id.in_(dag_ids))
               .options(joinedload(DagModel.schedule_dataset_references))
               .options(joinedload(DagModel.task_outlet_dataset_references))
   ```
   
   Looks equivalent to me? Surprising that Black allows this.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org