grafana / grafana/google-bigquery-datasource

Grafana 13.0.2 BigQuery Query Variable definition Field Always Cleared

Open
#522 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
40
Forks
24
Avg merge
3d 21h
Merged PRs (30d)
8

Description

**Environment**
Grafana version: `13.0.2`
RPM package: `grafana-13.0.2-1.x86_64`
OS: `Rocky Linux`
Datasource plugin: `grafana-bigquery-datasource`
Fresh Grafana installation
Fresh VM with no migrated dashboards or legacy plugins
Problem

When creating a Query Variable using the official BigQuery datasource, the variable works correctly and returns values, but the definition field is always saved as an empty string.

Example exported dashboard JSON:

```
{
"kind": "QueryVariable",
"spec": {
"name": "query0",
"query": {
"kind": "DataQuery",
"group": "grafana-bigquery-datasource",
"version": "v0",
"spec": {
"editorMode": "code",
"format": 1,
"location": "us-east4",
"project": "grafana-bq-blend",
"rawQuery": true,
"rawSql": "SELECT schema_name FROM `project_id.INFORMATION_SCHEMA.SCHEMATA` ORDER BY schema_name"
}
},
"definition": ""
}
}

```
Steps to Reproduce
Install Grafana 13.0.2 on a clean VM.
Install and configure the official BigQuery datasource.
Create a new dashboard.
Create a Query Variable.
Use a valid SQL query, for example:
```
SELECT schema_name
FROM `project_id.INFORMATION_SCHEMA.SCHEMATA`
ORDER BY schema_name

```
Run Query.
Save dashboard.
Export dashboard JSON.
Expected Behavior

The variable definition should contain either:

`the SQL query text, or any a generated definition string`

similar to how other datasource variable definitions are persisted.

Example:

`"definition": "SELECT schema_name FROM ..."`
Actual Behavior

The variable works correctly and returns values, but:

`"definition": ""`

is always written to the dashboard model.

If I manually edit the exported dashboard JSON and populate the definition field, Grafana displays it correctly after import. However, as soon as I open the variable editor and click Run Query/Save again, Grafana overwrites it back to:

`"definition": ""`
Additional Notes
Query execution succeeds.
Variable preview values are populated correctly.
Dashboard filtering works.
Reproduced on a completely clean Grafana 13.0.2 installation.
No legacy DoIT BigQuery datasource involved.
No migration from older Grafana versions.

Is this expected behavior for the official BigQuery datasource, or is this a bug in Grafana 13.x variable serialization?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.