Search code examples
jinja2apache-superset

How to use templated links in Apache Superset


In the time series table chart of Apache Superset, there is an option to create a "templated link" using the url field where it appears you can make the metric being displayed, for example, a link to another website or dashboard.

I have not found any documentation on how this is done and I am struggling to understand how this can be done. my ultimate goal is to allow a user to click on the metric of interest which will redirect to another pre-filtered dashboard.

url parameter in the time series table


Solution

  • I'm not sure if you can do what you want. Currently the URL field has access to the metric object of each row, which has the following attributes (this is an example for a simple COUNT(*) metric):

    {
      certification_details: null,​
      certified_by: null,
      d3format: null,
    ​  description: null,
    ​​  expression: "COUNT(*)",
      id: 24,
    ​  is_certified: false,
    ​​  metric_name: "count",
    ​​  verbose_name: "COUNT(*)",
    ​​  warning_text: null,
    }
    

    ​ So if you set URL to https://example.com/{{ metric.metric_name }} the metric name in the table will be a link pointing to https://example.com/count in this example (see the link at the bottom left of the screenshot):

    enter image description here