ephraimbuddy commented on code in PR #56422:
URL: https://github.com/apache/airflow/pull/56422#discussion_r2435676801
##########
airflow-core/src/airflow/models/serialized_dag.py:
##########
@@ -412,7 +412,7 @@ def write_dag(
serialized_dag_hash = session.scalars(
select(cls.dag_hash).where(cls.dag_id ==
dag.dag_id).order_by(cls.created_at.desc())
).first()
- dag_version = DagVersion.get_latest_version(dag.dag_id,
session=session, load_dag_model=True)
+ dag_version = DagVersion.get_latest_version(dag.dag_id,
session=session, load_serialized_dag=True)
Review Comment:
I thought about this for a while but can't help thinking the query is not
enough. So, I think we should go with a direct query here like this:
```python
session.query(DagVersion).where(DagVersion.dag_id == dag.dag_id,
DagVersion.bundle_version == bundle_version,
DagVersion.bundle_name==bundle_name).
options(joinedload(DagVersion.task_instances)).options(joinedload(DagVersion.serialized_dag).
order_by(DagVersion.created_at.desc()).limit(1)
```
and remove line 420 below where we do `and dag_version.bundle_name ==
bundle_name`
I think this is better as this is a special need that we don't do elsewhere.
Apologies for not thinking it through all these while
--
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]