-
What Grafana version and what operating system are you using?
9.2.5 -
What are you trying to achieve?
I want to have nice-looking variables - with country name
s in this example.
In the SQL query, I’d like to use the respective country_id
to optimize the SQL query.
- How are you trying to achieve it?
I have created an SQL query returning one column (<country_id>-<name>
) and used the Regex option to split it into two pars:/(?<value>\d+)-(?<text>.*)/
:
SELECT country_id || '-' || name FROM country
- What happened?
It was a little complex to build the regex, but it worked.
- What did you expect to happen?
I hoped that I could have something like the following, which is NOT working (it returns values from both columns, such as 1
, 2
, Germany
, …):
SELECT country_id AS value, name AS text FROM country
- Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
no errors (when SQL was correct ;-))
- Did you follow any online instructions? If so, what is the URL?
I’m wondering, if there is a way around using the regex, if I provide the correct column names.
Thanks a lot!
Steffen