1

i have some problems displaying my aws timestream data in grafana. I added as a global dashboard variable DevEUI with 3 different specific values. But when i am using the multivalue syntax ${DevEUI} in my query with more then one value i get everytime a error.

hope somebody can give me a hint.

Regards and thanks in advance

enter image description here

NcXNaV
  • 1,657
  • 4
  • 14
  • 23
Ew Na
  • 55
  • 7

3 Answers3

1

You are most probably having a list of values as the value of your multivalue Grafana variable, but you are still using the = operator in your query. Try ... and DevEUI IN ('${DevEUI}'). Or maybe without the single quotes or the parantheses... the exact syntax depends on your Grafana variable.

But, this is just an educated guess, since I cannot see neither your database schema nor the definition of this Grafana variable (both of which are important details in a question like yours, for future reference).

alparius
  • 60
  • 8
  • Did this solution work? I am facing issues even when using `IN`. – Joe Dec 23 '21 at 02:55
  • For example, when using `DevEUI IN ('${DevEUI}')`, the multi-value selections results in a query that has the following `WHERE` clause `DevEUI IN ('{value1, value2}')`. However, we need `DevEUI IN ('value1', 'value2')`. – Joe Dec 23 '21 at 03:03
0

This is how I did it for a multivalued string value:

timestream_variable_name = ANY(VALUES ${grafana_variable_name:singlequote})

You might have to adjust the formatting Grafana applies to the concatenated variable value it generates, depending on your data type.

0

I know this is long after the original question but @alparius pointed me in the right direction so I wanted to update the fix for the problem Joe reported. Use formatting to get the proper quotes/values when formatting your query. Something like this:

Select * from database where searchiterm IN (${Multi-Value_Variable:sqlstring})
Community
  • 1
  • 1
yufasa
  • 1
  • 2
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 21 '22 at 11:24
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/32964768) – nazim hatipoglu Oct 22 '22 at 18:54
  • But it does exactly answer the question - I know because I used this in a Grafana dashboard where the original answer does not work - maybe explain why this is not acceptable? – yufasa Oct 23 '22 at 11:57