grafana-trino icon indicating copy to clipboard operation
grafana-trino copied to clipboard

Grafana dashboard Variables are not interpolated

Open kikillus opened this issue 1 year ago • 7 comments

Hi, we are using Trino 428 with the official Trino datasource provided by Grafana in version 1.0.6

We have set some Dashboard variables in Grafana, e.g. variable1. However, using them in a Query they do not seem to be replaced.

A sample Query like the following

SELECT
    *
FROM
    table
WHERE
    $__timefilter(datetime) AND
    column1 = $variable1

Fails with (line no. won't match, above example) error querying the database: trino: query failed (200 OK): "io.trino.sql.parser.ParsingException: line 11:19: mismatched input '$'. Expecting: 'ALL', 'ANY', 'SOME', <expression>"

The query actually sent to trino looks like the following.

SELECT
    *
FROM
    table
WHERE
    datetime BETWEEN TIMESTAMP '2024-02-01 13:00:00' AND TIMESTAMP  '2024-02-01 13:59:59'  AND
    column1 = $variable1

The timefilter Macro seems to be applied correctly, while the dashboard variable does not get replaced.

We have contacted the Support by Grafana, they said the problem was within the trino plugin as using other datasources the variables are interpolated correctly.

kikillus avatar Feb 15 '24 10:02 kikillus