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 17:32:56 UTC

[GitHub] [airflow] jordanjeremy edited a comment on issue #16808: Wrong template field types for AWS operators

jordanjeremy edited a comment on issue #16808:
URL: https://github.com/apache/airflow/issues/16808#issuecomment-876615292


   As mentioned previously, this is not specific to AWS operators.  This issue also happens with @task decorated (TaskFlow API) operators, where the op_kwargs is a dict and is setup to be rendered as py.
   ![image](https://user-images.githubusercontent.com/72943478/124964827-148a9d00-dfe7-11eb-9057-47f6b0142d33.png)
   
   Possible solution is to update the ["get_python_source" in utils/code_utils.py](https://github.com/apache/airflow/blob/main/airflow/utils/code_utils.py#L27) to handle list and dict.  Possibly something like:
   ```
       if isinstance(x, list):
           return [str(v) for v in x]
   
       if isinstance(x, dict):
           return {k: str(v) for k, v in x.items()}
   ```
   The converting values to strings seems necessary in order to avoid errors when this is passed to the pygments lexer.
   ![image](https://user-images.githubusercontent.com/72943478/124964971-3dab2d80-dfe7-11eb-8f43-d1f4494fbfd5.png)


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