grafana / sqlds

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

Support FillMode per query #26

Closed andresmgot closed 3 years ago

andresmgot commented 3 years ago

Some of the existing data sources (e.g. PostgreSQL) support to specify a fill mode but just for the current query. The $__timeGroup macro of PostgreSQL states: $__timeGroup(dateColumn,'5m', 0), $__timeGroup(dateColumn,'5m', previous), $__timeGroup(dateColumn,'5m', NULL), being the third argument the fill mode.

As far as I can see, using sqlds is only possible to setup the fill mode globally for the datasource.

My suggestion would be to add an optional FillMissing struct to the Query and conditionally use that one (taking precedence over the Datasource fill mode). WDYT @kminehart ?

kminehart commented 3 years ago

Yeah that sounds great! An optional argument makes total sense.