-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Template variables expand to the text instead of the value #286
Comments
Hi @LS80, thanks for submitting this. I managed to reproduce it and will add it to our backlog. |
Possibly the same cause as with this one: grafana/iot-sitewise-datasource#233. I see that the variable value and text is the same in Athena like in Sitewise. They both have CustomVariableSupport for query variables (though it's been reverted in Sitewise) |
Hi @LS80 ! I was investigating this, and it seems like if you set the names as Can you try that and tell me if it works? |
Yes that does indeed work. Is there any reason why it's not |
Ah @LS80 , sorry, I missed that in the documentation. That is a bug! It sounds like we have a workaround for now, but |
Wait, this is not really working (at least not in the Redshift data source as filed in grafana/redshift-datasource#275): While a dummy query such as
indeed reveals
This always results in the text. (EDIT: I'm posting this here, as this has more details than the redshift issue, and I guess they require the same change) |
Hey @StephenKing great catch! I can recreate this as well, looks like we have a bug on our end. Some repro steps for anyone picking this up in the future: I have a table of test data that looks like this: I then create a variable that in theory I believe should create a list of catids as values, but where the visual text for it is the category names: Then I try to use that variable in my query: and I get an error, we can see in the query inspector, the query is interpolating the text instead of the value: This is again confirmed if I change my query to use the text instead of the value: I can recreate the same problem in athena. Will move this to the backlog for now, but will see if the team can look into prioritizing this. |
Hi @StephenKing, @LS80 we're just updating our docs, which should clarify how variables work in both Athena and Redshift:
|
Thanks a lot @idastambuk, that helped! |
@StephenKing Thanks for letting us know, will close this then :) |
What happened:
Template variables expand to the text instead of the value.
What you expected to happen:
The template variable has the value of the template variable not the display text.
How to reproduce it (as minimally and precisely as possible):
Create a template variable
var
using an Athena data source as the following queryThen use
$var
in the dashboard. The value should bebar
but it isfoo
.When I do the same for a PostgreSQL data source it works as expected.
Screenshots
Anything else we need to know?:
Environment:
The text was updated successfully, but these errors were encountered: