Skip to content

Rendered Templates not showing dictionary items in AF3 #57607

@csp33

Description

@csp33

Apache Airflow version

3.1.1

If "Other Airflow 2/3 version" selected, which one?

No response

What happened?

When following this guide, the Rendered Templates tab doesn't show one item per dictionary key, it shows the whole dictionary instead.

DAG Code:

from airflow import DAG
from datetime import datetime

from typing import Sequence

from airflow.models import BaseOperator


class MyConfigOperator(BaseOperator):
    template_fields: Sequence[str] = ("configuration",)
    template_fields_renderers = {
        "configuration": "json",
        "configuration.query.sql": "sql",
    }

    def __init__(self, configuration: dict, **kwargs) -> None:
        super().__init__(**kwargs)
        self.configuration = configuration

    def execute(self, context):
        pass

with DAG(dag_id="test_rtif", start_date=datetime(2024, 1, 1), schedule=None) as dag:
    config_task = MyConfigOperator(
        task_id="task_id_1",
        configuration={"query": {"job_id": "123", "sql": "select * from my_table"}},
    )

Airflow 2:

Image

Airflow 3:

Image

What you think should happen instead?

Each dictionary key should be independently rendered in the Rendered Templates view. The sql field should be shown as a sepparate entry in the AF3 UI

How to reproduce

already specified in description

Operating System

Airflow in k8s

Versions of Apache Airflow Providers

No response

Deployment

Official Apache Airflow Helm Chart

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Labels

affected_version:3.1Issues Reported for 3.1area:UIRelated to UI/UX. For Frontend Developers.area:corekind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yet

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions