Creating a query editor

I have received a very specific request if it would be possible to create a very simplified graphical query editor (for the noob user). Goal is if to make a query editor where the user only needs to select a field name to get the data displayed. Most of the queries (that will be created under the hood) will be always the same for all fields.

Can someone point me to a good starting point how to create a query editor ? I like the challenge to build something on a package/language that I have no experience with yet.

The editor that I want to create will be for a MS SQL database, so it might be a good starting point for a general purpose MSSQL query editor as well


I’d love to see something like that :slight_smile: To create a custom query editor, you’d need to create your own data source plugin. You can read more about how to do this in the Build a data source plugin tutorial.

1 Like

Dear @barts2108,

I second that.

Will it look similar to jQuery QueryBuilder or how to you imagine this thing?

With kind regards,

Well, what I have in mind is quite specific for our use case. When a user (considered Noob^2) wants to add a panel, the options he/she has is to select from a list of andalog/digital signals that are available in the database.

So instead of selections for “from”, fields, count/mean/aggregates etc etc. create something real user friendly for our case.

However that might also turn into a more friendly query builder like there is for influxdb and others.

A liitle hint about noob^2 : The user will be able to understand that he/she has to choose from a list with names like “Temperature”, “Voltage” etc, but has no idea what to do with SQL queries, not even with a “SQL for dummies” manual. In that page the first image. That kind of query editor is ok for me, it is too complex for our users.

Finally able to take a look at this. I copied the postgresql datasource plugin and replaced all prostres names with ‘mydstest’ . Although I can see the datasource in the list, when I select it I get an error

Unexpected token ‘<’ Evaluating http://localhost:3000/public/app/plugins/datasource/mydstest/module Loading app/plugins/datasource/mydstest/module

Anybody having hints why is that ?

(Windows installation of grafana v7.0.3)

Edit: Unexpected token '<' Evaluating
There I got an answer for this problem.

Hey any updates? Im trying to do just the same

I solved it using varaibles for now, using provisioning for datasources and some default dashboards (provisioned)