Dev-iL commented on code in PR #58062:
URL: https://github.com/apache/airflow/pull/58062#discussion_r2531275386
##########
airflow-core/src/airflow/models/serialized_dag.py:
##########
@@ -648,11 +650,11 @@ def load_json(deps_data):
.join(cls.dag_model)
.where(~DagModel.is_stale)
)
- iterator = (
- [(dag_id, load_json(deps_data)) for dag_id, deps_data in query]
- if load_json is not None
- else query.all()
- )
- resolver = _DagDependenciesResolver(dag_id_dependencies=iterator,
session=session)
+ if load_json is not None:
+ iterator_result = [(dag_id, load_json(deps_data)) for dag_id,
deps_data in query]
+ else:
+ iterator_result = [(str(row[0]), row[1] if row[1] else []) for row
in query.all()]
Review Comment:
Note that a generator was changed into a list - I'm not sure this is
desired. I think the main issue is that the expression is quite complex and
doesn't work that well as a "one-liner" comprehension. I think that a protected
helper method that uses `for` and `yield` would be more readable and easier to
type hint in this case.
--
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]