uranusjr commented on code in PR #31772:
URL: https://github.com/apache/airflow/pull/31772#discussion_r1222654583
##########
airflow/api_connexion/endpoints/log_endpoint.py:
##########
@@ -77,18 +78,17 @@ def get_log(
if not task_log_reader.supports_read:
raise BadRequest("Task log handler does not support read logs.")
query = (
- session.query(TaskInstance)
- .filter(
+ select(TaskInstance)
+ .where(
TaskInstance.task_id == task_id,
TaskInstance.dag_id == dag_id,
TaskInstance.run_id == dag_run_id,
TaskInstance.map_index == map_index,
)
.join(TaskInstance.dag_run)
- .options(joinedload("trigger"))
- .options(joinedload("trigger.triggerer_job"))
+ .options(joinedload(TaskInstance.trigger))
Review Comment:
I think we still need to do the join though, it’s needed in
`read_log_stream` and not joining it would incur at least one additional SQL
fetch.
[SQLAlchemy documentation says the load options can be
chained](https://docs.sqlalchemy.org/en/20/orm/queryguide/relationships.html)
so we probably need to do something like this:
```python
.options(joinedload(TaskInstance.trigger).joinedload(Trigger.triggerer_job))
```
--
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]