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 18:28:23 UTC

[GitHub] [airflow] mightydeveloper opened a new issue #16892: Render template for dictionary keys

mightydeveloper opened a new issue #16892:
URL: https://github.com/apache/airflow/issues/16892


   When rendering jinja template, it is rendered recursively for some kind of collection type. (list, tuple, set, ...)
   However, for the dictionary type, only the `value` part is rendered while the `key` part is not rendered.
   
   I am wondering if this behavior is intended due to some unwanted behavior.
   If not, I want to suggest to render the keys as well during the rendering.
   
   **Use case / motivation**
   In my use case, both keys and values have to dynamically change.
   When rendering the following dictionary object, (with `template_key = "some_key"` and `template_value = "some_value"`)
   ```
   {'{{ template_key }}': '{{ template_value }}'}
   ```
   Currently, the behavior is 
   ```
   {'{{ template_key }}': 'some_value'}
   ```
   However, I would like to have
   ```
   {'some_key': 'some_value'}
   ```
   
   **Are you willing to submit a PR?**
   
   Yes, I would like to contribute!
   
   I believe the following line has to be modified.
   https://github.com/apache/airflow/blob/2b10680a2f5188400459089713876c1ce49f1caf/airflow/models/baseoperator.py#L1068
   
   **Related Issues**
   
   I am not aware of other related issue.
   


-- 
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] potiuk commented on issue #16892: Render template for dictionary keys

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


   This feature has now been merged via #17321


-- 
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] jedcunningham commented on issue #16892: Render template for dictionary keys

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


   @mightydeveloper, I can't think of a reason why we couldn't template the key too. Give it a shot and see if any tests break. I'm assigning this to you 👍


-- 
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] boring-cyborg[bot] commented on issue #16892: Render template for dictionary keys

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on issue #16892:
URL: https://github.com/apache/airflow/issues/16892#issuecomment-876652923


   Thanks for opening your first issue here! Be sure to follow the issue template!
   


-- 
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] potiuk closed issue #16892: Render template for dictionary keys

Posted by GitBox <gi...@apache.org>.
potiuk closed issue #16892:
URL: https://github.com/apache/airflow/issues/16892


   


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