Closed mzealey closed 1 month ago
I want to avoid adding too many macros like this, especially when ClickHouse has functions built in for these types of time operations.
Can you show me an example of a query you would write with the macro vs without the macro? You should be able to use the other macros/variables to accomplish this, such as $__fromTime
and $__toTime
. This will give you a DateTime
value that you can plug into the ClickHouse functions.
Thanks for the suggestion!
This sounds reasonable, however it is a real pain (if even possible) to convert the interval from grafana (either seconds or 1M format) into "interval 1 month". So perhaps a $__intervalSql type variable that does this?
Good point, we actually have an issue open for this (#528)
We can close this issue in favor of that one since it's already been triaged as a feature request
I'm using $__timeInterval and want to get a monthly summary (changeable to daily etc via drop-down variable). However because it's using a simple seconds since epoch calculation it comes out with grouping on 16/17 of month at present.
A $__timeIntervalStartOf type macro would be really useful that uses the toStartOfInterval function to produce the expected/correct result in this case.