I have been trying to use the __user.email variable with no luck. The __user.login variable seems to work. I use postgres and my grafana variable query is:
SELECT privileges.site as __text
FROM privileges
WHERE privileges.email = ‘{__user.email}'
UNION
SELECT name as __text
FROM sites
WHERE '{__user.login}’ = ‘admin’;
I get an error on line 3 if I use __user.email, but not if I use __user.login (although then my code doesn’t work correctly).