Skip to content

Jinja templating is ignored in Metrics definitions #6983

@rmacnguyen

Description

@rmacnguyen

Make sure these boxes are checked before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven't found one similar.

Superset version

0.29.0rc7 (latest on pypi)

Expected results

Not sure if this is intentional, but it seems like Jinja templating used when defining metrics using custom SQL should be parsed and rendered similarly to how it works when defining filters.

Actual results

Jinja templating in metrics is effectively ignored and sent to the query engine as is.

Steps to reproduce

Add a metric to a chart that includes Jinja templating. For example, define a metric as max('{{ from_dttm }}'). The rendered SQL shows that the templating is ignored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    .pinnedDraws attention

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions