Repeating Rows based on a Variable breaks query by automatically adding single 'quote' marks

  • What Grafana version and what operating system are you using?
    Grafana 9.1.8

  • What are you trying to achieve?
    Repeating rows in dashboard based on variable

  • How are you trying to achieve it?
    Variable type Custom with comma separated values
    It works fine for none repeating rows dashboard

  • What happened?
    Single quote marks get inserted and query breaks
    When adding a row that is repeating on the variuable, then the expression used in the query where the variable is part of the query gets expanded and single quote marks are added around the variable result.

  • What did you expect to happen?
    no extra characters to be added around the variable expansion

  • Can you copy/paste the configuration(s) that you are having problems with?

I have the following variable defined: asset
custom values: line_1/row_1, line_1/row_2, line_2/row_1

In a dashboard with repeating rows the query gets expanded as follows:

Query template:
FROM table
time BETWEEN ‘2023-09-21T04:51:12.338Z’ AND ‘2023-09-21T10:51:12.338Z’ AND topic = ‘root/${asset}/energy’ AND

When using repeat rows this gets expanded to:
topic = ‘root/‘line_1/row_1’/energy’

When not using repeat then it gets expanded to:
topic = root/line_1/row_1/energy’

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    db query error: pq: syntax error at or near “line_1”

  • Did you follow any online instructions? If so, what is the URL?

I can now answer my own question.

Adding :raw to the varable in the expression removes single quotes / doesn’t add them. More details can be found here: