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


##########
airflow/models/dag.py:
##########
@@ -1613,7 +1613,8 @@ def _get_task_instances(
 
         # Do we want full objects, or just the primary columns?
         if as_pk_tuple:
-            tis = session.query(TI.dag_id, TI.task_id, TI.run_id, TI.map_index)
+            # try number is needed here since its used to construct 
TaskInstanceKey
+            tis = session.query(TI.dag_id, TI.task_id, TI.run_id, 
TI._try_number, TI.map_index)

Review Comment:
   Is `try_number` really functionally needed, or just to fill the argument 
position? If it’s only the positional issue, we can instead do
   
   ```python
   tis = session.query(TI.dag_id, TI.task_id, TI.run_id, TI.map_index)
   # ... later ...
   results.update(TaskInstanceKey(**cols._mapping) for cols in tis)
   ```
   
   Relevant SQLAlchemy documentation: 
https://docs.sqlalchemy.org/en/14/core/connections.html#sqlalchemy.engine.Row._mapping



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