Custom datasource plugin : inherit MySQL or alternative?

Hi All !

I am developing a new custom datasource, and I need help to at least understand the datasource implementation.
Note : I have already developed a panel plugin.

I need to query a MySQL database (SELECT, UPDATE), but i don’t need user input (it’s like “static”/“fixed” queries).

So, i have started with copying the MySQL datasource embedded in Grafana to a new datasource plugin, but there is an error throwed by the backend TSDB saying that there is no executor available for my plugin id.
(to test later : to override datasourceId, but It is very amateur)

Now, I plan to create a new plugin, inheriting from the SQL datasource (as I inherited from MetricPanel for my custom panel plugin). Is it possible ?

I have also read to use backendSrv : using it, will I achieve what I need ?

I would avoid at possible to create a panel, as what i want to achieve is more relevant as a datasource.

Thank you for your help,


I figured out an other, very easy way to achieve what I wanted : in a panel, I make an XHR call to the API (api/tsdb/query) with my custom parameters.

Could you share a little more (maybe some code snippets) how you have done this ? I am currently in the process of doing something the same with MSSQL, and I am stuck at the connection to the DB. I thought I can easily extend the builtin mssql plugin but still cannot find it.

When I use the “api/tsdb/query” things as in the builtin plugin, I am running into some "Could not find executor for datasource type: " error in the logs