I am building a simple Grafana dashboard that would act as a (simplified) DB client for our support team. One of the important queries is an output based on a list of input values.
I want to construct a variable + query so that:
- For variable1 a list of values are added, for example value1, value2, value3
- Based on the variable input returned dataset is filtered correspondingly.
I used text box variables where user can freely define the values inside the textbox
I used IN operator in my postgreSQL query like that:
...
FROM myTable
WHERE
('$variable_entitlement_id' = '' OR entitlement_id IN ('$variable_entitlement_id') AND
('$variable_public_id' = '' OR public_id IN ('$variable_public_id'))
But it does not return expected result as formatting is off:
bundles.public_id IN ('value1, value2, value3, value4, value5, value6, value7, value8')
Are there any ways to tweak the standard formatting so that the IN operator can do its magic based on the input from the variable?
Or are there better alternatives you would suggest to achieve my goal?