jsnb-devoted commented on code in PR #40478:
URL: https://github.com/apache/airflow/pull/40478#discussion_r1893285838


##########
airflow/models/dag.py:
##########
@@ -3314,7 +3316,14 @@ def bulk_write_to_db(
                     input_datasets[DatasetModel.from_public(dataset)] = None
             curr_outlet_references = curr_orm_dag and 
curr_orm_dag.task_outlet_dataset_references
             for task in dag.tasks:
-                dataset_outlets = [x for x in task.outlets or [] if 
isinstance(x, Dataset)]
+                dataset_outlets: list[Dataset] = []
+                dataset_alias_outlets: list[DatasetAlias] = []
+                for outlet in task.outlets:

Review Comment:
   hi @Lee-W -- we just starting testing our upgrade for `2.9.1` to `2.10.4` 
and spent a while trying to debug a `'NoneType' object is not iterable` error 
that was showing up when serializing our dags. We had a function that created 
tasks that defaulted the outlet kwarg as `None` instead of `[]`:
   ```python
   def make_task(task_name,  outlets = None)
   ```
   Updating the default kwarg value to the empty list fixed it but just wanted 
to mention that it might be helpful to provide the default iterable empty list 
like the previous version did:
   ```python
   for outlet in task.outlets or []
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to