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/07/08 09:33:43 UTC

[GitHub] [airflow] ashb commented on issue #16618: Access specific values within an `XCom` value using Taskflow API

ashb commented on issue #16618:
URL: https://github.com/apache/airflow/issues/16618#issuecomment-876288276


   Hmmm, the "native" way I would like this to work is:
   
   ```python
   my_op.output['dataflow_job_id']
   # Ideal, would be equivalent. to my_op.xcom_pull(key='return_value')['dataflow_job_id']
   ```
   
   But sadly XComArg already has a `__getitem__` to override the key, which means it is actually 
   
   ```python
   my_op.output['dataflow_job_id']
   # Ideal, would be equivalent. to my_op.xcom_pull(key="dataflow_job_id"]
   ```
   
   If we hadn't yet released it, I would have suggested that the facility to change the key should have been done by `__getattr__`, yielding:
   
   ```python
   my_op.output.some_xcom_key # my_op.xcom_pull(key='some_xcom_key')
   my_op.output['attr'] # my_op.xcom_pull(key='return_value')['attr']
   ```
   
   But that ship is sailed, so I'm not sure how to proceed nicely.


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