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

Dynamic way of getting a 'default dataset' or 'default region'? #258

Open
MatinF opened this issue May 14, 2024 · 1 comment
Open

Dynamic way of getting a 'default dataset' or 'default region'? #258

MatinF opened this issue May 14, 2024 · 1 comment
Labels
type/feature-request New feature or request

Comments

@MatinF
Copy link

MatinF commented May 14, 2024

We are trying to create a Grafana-BigQuery dashboard template as per below screenshot. The goal is to provide this template to our end users who will deploy it with their own BigQuery datasources across the globe.

These users will have their own dataset names and are trying to make this as dynamic as possible by e.g. querying the user's dataset via a Variable query as below:

SELECT
  schema_name as dataset_id
FROM
 region-europe-west3.INFORMATION_SCHEMA.SCHEMATA

This returns the datasets in that region - but it has the downside, as evident, that the region has to be hardcoded by every user that deploys the template - either by editing the template JSON, or by editing the Variable once loaded.

We need the dataset as it serves as a variable in our panel queries, which look as below:

SELECT
  TIMESTAMP_MILLIS(DIV(UNIX_MILLIS(t), $__interval_ms) * $__interval_ms) as time,  
  ${signal_value:csv}
FROM
  ${dataset}.tbl_${device:csv}_${message:csv}
WHERE
  $__timeFilter(t)
GROUP BY
  time

We can of course consider adapting our guide to enforce that the user has to specify a specific dataset name - but we would rather want to make this more dynamic. Is there a way to return a 'default' dataset and/or 'default' region for a Project via e.g. macros/variables?

image

@gabor
Copy link

gabor commented May 21, 2024

hi @MatinF , as far as i understand there's no default-region or default-dataset as a concept in bigquery (feel free to correct me if i'm wrong 😄 ), so ... i'm not sure how would this work. i mean, the user would have to fill in these 2 values somewhere, right?

i would recommend creating a custom dashboard variable for this, and the user only has to adjust that single one, and then the other dashboard-queries would use the value of that custom variable.

@gabor gabor moved this to Backlog in OSS Big Tent May 23, 2024
@ivanahuckova ivanahuckova added the type/feature-request New feature or request label Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature-request New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

3 participants