You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/12/07 20:35:33 UTC

[GitHub] [airflow] PrincipalsOffice opened a new issue #20116: TaskInstance.execution_date still being referenced in queries

PrincipalsOffice opened a new issue #20116:
URL: https://github.com/apache/airflow/issues/20116


   ### Apache Airflow version
   
   2.2.2 (latest released)
   
   ### What happened
   
   I was trying to call `task.get_task_instances()` but received an error `sqlalchemy.exc.ArgumentError: SQL expression object expected, got object of type <class 'sqlalchemy.ext.associationproxy.ColumnAssociationProxyInstance'> instead`.
   
   Looking at the code, it's trying to query `TaskInstance.execution_date` which is no longer a column. https://sourcegraph.com/github.com/apache/airflow@944dcfb/-/blob/airflow/models/baseoperator.py?L1252:21
   
   ### What you expected to happen
   
   Perhaps the query should compare `TaskInstance.start_date` against start_date and `TaskInstance.end_date` against end_date instead?
   
   ### How to reproduce
   
   Create a dag with random tasks, get one of the tasks, then call `task.get_task_instances(...)`.
   
   ### Operating System
   
   Debian GNU/Linux
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Other Docker-based deployment
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb commented on issue #20116: BaseOperator.get_task_instances is broken due to order by TaskInstance.execution_date

Posted by GitBox <gi...@apache.org>.
ashb commented on issue #20116:
URL: https://github.com/apache/airflow/issues/20116#issuecomment-988700809


   Oh, we updated DAG.get_task_instances, but forgot to update BaseOperator.get_task_instances as well


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] PrincipalsOffice commented on issue #20116: BaseOperator.get_task_instances is broken due to order by TaskInstance.execution_date

Posted by GitBox <gi...@apache.org>.
PrincipalsOffice commented on issue #20116:
URL: https://github.com/apache/airflow/issues/20116#issuecomment-988487760


   @ashb I have updated the "How to reproduce" section with a reproducible snippet. 


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] uranusjr commented on issue #20116: BaseOperator.get_task_instances is broken due to order by TaskInstance.execution_date

Posted by GitBox <gi...@apache.org>.
uranusjr commented on issue #20116:
URL: https://github.com/apache/airflow/issues/20116#issuecomment-988511457


   > This is *meant* to be a backwards compatibility shim
   
   Not really, the function has not been touched (except to apply Black) in three years, and is not used at all in the code base, and therefore alluded attention during the `run_id` migration.
   
   ----
   
   Feel free to submit a pull request for this. The fix should join DagRun on TaskInstance on `run_id`, and order the result by `DagRun.execution_date` instead. You should be able to find some examples in the code base by searching for `order_by(DagRun.execution_date)`. A test would be needed as well.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb commented on issue #20116: BaseOperator.get_task_instances is broken due to order by TaskInstance.execution_date

Posted by GitBox <gi...@apache.org>.
ashb commented on issue #20116:
URL: https://github.com/apache/airflow/issues/20116#issuecomment-988285593


   This is _meant_ to be a backwards compatibility shim, so that `ti.execution_date` on an instance, and `TaskInstance.execution_date` in a query both behave as expected.
   
   Can you provide a reproduction case for this?


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org