Convert field type to numeric


I’m developing a data source plugin for a “database” which returns everything as string. So I’m challenged to convert fields to the “right” type.

I’m wondering, what the best approach is here.

I’m parsing as time when the column is named “time”.
Otherwise, I attempt to parse every field as an int:

intVal, err := strconv.Atoi(*stringVal)

However, Grafana still does not recognize it as numeric and complains “No numeric fields found”. Only when I add (in the user interface) a transformation of “Convert field type” to Numeric, I have beautiful charts.

What’s expected here for my plugin to return?

full code

Thanks for our help

Maybe you need to use driver specific data types. Had a look at sqlds and it calls sqlutil.FrameFromRows here

Please have a look at