Chaining constant variables with MySQL database

  • What Grafana version and what operating system are you using?

  • What are you trying to achieve?
    I want to define a constant variable which contains a query, based on another constant variable as subquery

  • How are you trying to achieve it?
    I now have to substitute the whole subquery instead of just the $[VariableName]

  • What happened?
    I always get an error

  • What did you expect to happen?
    I wanted to merge both the query and subquery into a unique variable

  • Can you copy/paste the configuration(s) that you are having problems with?
    It is something like:
    SELECT TimeStamp, State, EventTrigger, lead(state) OVER (ORDER BY TimeStamp asc) as NextState, lead(EventTrigger) OVER (ORDER BY TimeStamp asc) as NextEventTrigger FROM ($All_Semi_Info) subquery1

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

  • Did you follow any online instructions? If so, what is the URL?

Hi @jmatetx,

Welcome to the :grafana: community support forums !!

We are excited that you joined our OSS community. Please read about some of the FAQs in the community :slight_smile:

I am not an expert with MySQL queries but we do have documentation which defines how to create template variables for the queries. It can at least give you some start to proceed.

Hopefully, other community members can help you out :slight_smile: