grafana / sqlds

A package that assists writing SQL-driven datasources
Apache License 2.0
18 stars 12 forks source link

Recurring macros are not honoured. #5

Closed yesoreyeram closed 3 years ago

yesoreyeram commented 3 years ago

If a query have same macro multiple times, only the first occurrence is getting replaced.

For example, in the below query $__timeGroup(timestamp,3h) was expected to replaced thrice. but only the first instance was replaced.

SELECT $__timeGroup(timestamp,3h), "user", sum("value") as "value"
FROM "salesdata"
WHERE $__timeFilter("timestamp")
GROUP BY  $__timeGroup(timestamp,3h), "user"
ORDER BY $__timeGroup(timestamp,3h)  ASC