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.  **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`  **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]
