Skip to content
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

Retrieve query name as macro variable #288

Open
victormico opened this issue Jun 20, 2024 · 2 comments
Open

Retrieve query name as macro variable #288

victormico opened this issue Jun 20, 2024 · 2 comments

Comments

@victormico
Copy link

Is your feature request related to a problem? Please describe.
Currently I have my grafana dashboards as code. I would like to paramtertize the query parameters as much as possbile in order to not have things hardcoded in the query string.
For instance:

{
  "database": ":database_name",
  "datasource": {
    "type": "grafana-timestream-datasource",
    "uid": ":datasource_id"
  },
  "hide": true,
  "measure": "sensor_1",
  "rawQuery": "SELECT \r\n  time,\r\n  measure_value::double AS 'First Sensor'\r\n FROM $__database.$__table	\r\nWHERE $__timeFilter\r\n AND measure_name = $__measure \r\n \r\nORDER BY time ASC",
  "refId": "First Sensor",
  "table": ":table_name"
}

I would like to have the query name, this is the refId parameter, as a variable in the rawQuery.

Describe the solution you'd like
An additional macro called $__refId. To be able to do the following query:

SELECT
  time,
  measure_value::double AS $__refId
FROM $__database.$__table
WHERE $__timeFilter
AND measure_name = $__measure
ORDER BY time ASC

Describe alternatives you've considered
NA
Additional context
Link to a petition in the grafana forum:

@iwysiu
Copy link
Contributor

iwysiu commented Jun 21, 2024

Hi @victormico ! Thanks for the feature request, I'll move this to our backlog to be considered.

@iwysiu iwysiu moved this from Incoming to Backlog in AWS Datasources Jun 21, 2024
@victormico
Copy link
Author

Hi @iwysiu any update on this? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

2 participants