Convert field type to numeric

Hi,

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
Steffen

Maybe you need to use driver specific data types. Had a look at sqlds and it calls sqlutil.FrameFromRows here https://github.com/grafana/sqlds/blob/dda2dc0a54b128961fc9f7885baabf555f3ddfdc/query.go#L149.

Please have a look at https://github.com/grafana/grafana-plugin-sdk-go/blob/ce5b3f92a74beb905e23eec7660da6824a2107a5/data/sqlutil/sql.go#L22