VolkovLabs / business-forms

The Business Forms panel is a conceptually new plugin for Grafana. It is the first plugin that allows inserting and updating application data, as well as modifying configuration directly from your Grafana dashboard.
https://docs.volkovlabs.io
Apache License 2.0
86 stars 10 forks source link

Multi-statement mysql queries #279

Closed steelskillet closed 11 months ago

steelskillet commented 1 year ago

The form I have requires data to be inserted into multiple tables on the database (mysql) during the 'Update' step. I don't believe there is currently a way to do this, but if there is that would be great.

steelskillet commented 1 year ago

I figured it out by just using grafana's web api and custom update request. feels a little wonky but it works for now. I also saw a PR for grafana to allow multi-statement sql queries, that may solve the problem as well.

asimonok commented 11 months ago

@steelskillet we don't support several queries to simplify the panel. You can use a custom code for update request and run several queries yourself.

fetch('/api/ds/query',
  method: 'POST',
  body: JSON.stringify({
    queries: [
      {
        datasourceUid: ',
        refId: 'A',
        ...payload,
      },
      // another one
    ],
  }),
)

Please check the swagger - https://editor.swagger.io/?url=https://raw.githubusercontent.com/grafana/grafana/main/public/api-merged.json to see all available fields for the endpoint