grafana / redshift-datasource

Apache License 2.0
9 stars 11 forks source link

Timegroup Granularity via Variable: Errors on Quarter #295

Open jjspratt opened 2 months ago

jjspratt commented 2 months ago

What happened: Query failure on $__timeGroup(column, $Granularity) when Quarter selected.

Granularity defined as

Week = 1w, Month = 1M, Quarter = 1Q

What you expected to happen: I expect to see results similar to date_trunc('quarter', column). This is what I experience when selected Week or Month.

How to reproduce it (as minimally and precisely as possible):

  1. create custom variable: Week : 1w, Month : 1M, Quarter : 1Q
  2. add a panel
  3. Select Redshift as source
  4. Add following as custom query:
with time as (select GETDATE() as "test")

select 
time.test
,$__timeGroup(time.test, $Granularity)
from time
  1. select 'Table View'
  2. Change variable from Week to Month to Quarter
  3. Upon selecting Quarter see error text: Could not apply macros: error parsing interval 1Q

-->

Screenshots

If applicable, add screenshots to help explain your problem. -->

Anything else we need to know?:

Environment:

njvrzm commented 2 months ago

This does look like a gap in our plugin sdk. I'll bring this up with the team next week and we'll see about getting it into the backlog. Thanks!