YangMuye opened a new issue #13988:
URL: https://github.com/apache/airflow/issues/13988


   
   OracleOperator
   
   **Apache Airflow version**: 2.0.0
   
   **Kubernetes version (if you are using kubernetes)** (use `kubectl 
version`): n/a
   
   **Environment**: Linux
   
   - **Cloud provider or hardware configuration**: amd64
   - **OS** (e.g. from /etc/os-release): Centos 7
   - **Kernel** (e.g. `uname -a`):
   - **Install tools**: pip
   - **Others**:
   
   **What happened**:
   
   The field `sql` is rendered as a serialized json `["select 1 from dual", 
"select 2 from dual"]` instead of a list of syntax-highlighted SQL statements.
   
   
![image](https://user-images.githubusercontent.com/5377410/106365382-2f8a1e80-6370-11eb-981a-43bf71e7b396.png)
   
   **What you expected to happen**:
   
   `lists` and `dicts` should be rendered as lists and dicts rather than 
serialized json unless the `template_field_renderer` is `json`
   
   
![image](https://user-images.githubusercontent.com/5377410/106365216-f3a28980-636e-11eb-9c48-15deb1fbe0d7.png)
   
   
   **How to reproduce it**:
   
   ```
   from airflow import DAG
   from airflow.providers.oracle.operators.oracle import OracleOperator
   
   with DAG("demo", default_args={owner='airflow'}, start_date= 
pendulum.yesterday(), schedule_interval='@daily',) as dag:
       OracleOperator(task_id='single', sql='select 1 from dual')
       OracleOperator(task_id='list', sql=['select 1 from dual', 'select 2 from 
dual'])
   ```
   
   **Anything else we need to know**:
   
   Introduced by #11061, .
   
   A quick and dirty work-around:
   
   Edit file 
[airflow/www/views.py](https://github.com/PolideaInternal/airflow/blob/13ba1ec5494848d4a54b3291bd8db5841bfad72e/airflow/www/views.py#L673)
   
   ```
               if renderer in renderers:
   -                if isinstance(content, (dict, list)):
   +               if isinstance(content, (dict, list)) and renderer is 
renderers['json']:
                       content = json.dumps(content, sort_keys=True, indent=4)
                   html_dict[template_field] = renderers[renderer](content)
   ```


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to