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
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)
Apache Airflow version: 2.0.0
Kubernetes version (if you are using kubernetes) (use
kubectl version): n/aEnvironment: Linux
uname -a):What happened:
The field
sqlis 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:
listsanddictsshould be rendered as lists and dicts rather than serialized json unless thetemplate_field_rendererisjsonHow to reproduce it:
Anything else we need to know:
Introduced by #11061, .
A quick and dirty work-around:
Edit file airflow/www/views.py