is it possible to use Grafana's userID or user variables in MySQL query ?
For example :
SELECT id,name FROM table WHERE user_id=$Grafana.User.id
Or is there another way to assign a custom variable to specific user within Grafana ?
is it possible to use Grafana's userID or user variables in MySQL query ?
For example :
SELECT id,name FROM table WHERE user_id=$Grafana.User.id
Or is there another way to assign a custom variable to specific user within Grafana ?
It is available in Grafana 7.1+ as ${__user.id}
. Check the doc: https://grafana.com/docs/grafana/latest/variables/variable-types/global-variables/
This should work:
SELECT id,name FROM table WHERE user_id=${__user.id}
© 2022 - 2024 — McMap. All rights reserved.