Grafana 13.0.2 BigQuery Query Variable definition Field Always Cleared

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": "revx-grafana-bq-blend",
        "rawQuery": true,
        "rawSql": "SELECT schema_name FROM `project_id.INFORMATION_SCHEMA.SCHEMATA` ORDER BY schema_name"
      }
    },
    "definition": ""
  }
}

Steps to Reproduce

  1. Install Grafana 13.0.2 on a clean VM.
  2. Install and configure the official BigQuery datasource.
  3. Create a new dashboard.
  4. Create a Query Variable.
  5. Use a valid SQL query, for example:
SELECT schema_name
FROM `project_id.INFORMATION_SCHEMA.SCHEMATA`
ORDER BY schema_name
  1. Run Query.
  2. Save dashboard.
  3. Export dashboard JSON.

Expected Behavior

The variable definition should contain either:

  • the SQL query text, or
  • 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, 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?

This is a issue in the grafana-bigquery-datasource plugin.

The plugin has getQueryDisplayText() on the datasource class, but Grafana looks for it on the this.variables object. Since it’s missing there, definition is always saved as "".

Confirm by inspecting the installed plugin:

bash

grep -o '.\{0,120\}this\.variables.\{0,120\}' \
  /var/lib/grafana/plugins/grafana-bigquery-datasource/module.js


The Fix

In src/datasource.ts, add getQueryDisplayText inside this.variables:

typescript

this.variables = {
  getType: () => VariableSupportType.Custom,
  editor: VariableEditor as any,
  getQueryDisplayText: (query: BigQueryQueryNG): string => {
    return query?.rawSql ?? '';
  },
  query: (request: DataQueryRequest<BigQueryQueryNG>) => {
    const queries = request.targets.map((query) => {
      return { ...query, refId: query.refId || uniqueId('tempVar') };
    });
    return this.query({ ...request, targets: queries });
  },
};

Workaround for installed plugins (without rebuilding):

  1. Open /var/lib/grafana/plugins/grafana-bigquery-datasource/module.js
  2. Find the this.variables object
  3. Locate editor: inside it and add getQueryDisplayText:(e)=>{return(e&&e.rawSql)?e.rawSql:“”}, immediately after it
  4. Add GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=grafana-bigquery-datasource to your Grafana environment
  5. Restart Grafana

Hi @infofcc3 /Team , Thanks for the quick response and for always helping us troubleshoot these issues.

Unfortunately, the change did not fix the problem. Since I am not very familiar with the codebase, I am not entirely sure whether I modified the exact section you were referring to. From what I can see, there are some slight differences, and I’m not sure whether those differences are relevant.

Anyway, please refer to the details below for reference.

Original file:
unction*(){var e;const t=yield this.callHealthCheck();if("error"===(null===(e=t.status)||void 0===e?void 0:e.toLowerCase()))return Promise.reject({status:"error",message:t.message,error:new ae.HealthCheckError(t.message,t.details)});const r=yield y_(this.uid);try{yield r.getProjects()}catch(e){var n,o,i;return Promise.reject({status:"error",message:(null===(n=e.data)||void 0===n?void 0:n.message)||"Error connecting to resource manager.",error:new ae.HealthCheckError(null===(o=e.data)||void 0===o?void 0:o.message,null===(i=e.data)||void 0===i?void 0:i.details)})}return{status:"OK",message:"Data source is working"}}).call(this)}applyTemplateVariables(e,t){const r=(0,ae.getTemplateSrv)().replace(e.rawSql,t,l_);return{refId:e.refId,hide:e.hide,key:e.key,queryType:e.queryType,datasource:e.datasource,rawSql:r,format:e.format,connectionArgs:{dataset:e.dataset,table:e.table,location:e.location,enableStorageAPI:e.enableStorageAPI||!1}}}constructor(e){super(e),aw(this,"instanceSettings",void 0),aw(this,"jsonData",void 0),aw(this,"authenticationType",void 0),aw(this,"annotations",void 0),this.instanceSettings=e,this.annotations={},this.jsonData=e.jsonData,this.authenticationType=e.jsonData.authenticationType||ce.JWT,this.variables={getType:()=>R.VariableSupportType.Custom,editor:nw,query:e=>{const t=e.targets.map(e=>lw(uw({},e),{refId:e.refId||(0,qE.uniqueId)("tempVar")}));return this.query(lw(uw({},e),{targets:t}))}}}}const pw=new R.DataSourcePlugin(cw).setConfigEditor(e=>{const{options:t,onOptionsChange:r}=e,{jsonData:n}=t,o=n.authenticationType===ce.JWT||n.authenticationType===ce.GCE;return C().createElement(C().Fragment,null,C().createElement(ne,{dataSourceName:"Google BigQuery",docsLink:" Google BigQuery plugin for Grafana | Grafana Labs ",hasRequiredFields:!1}),C().createElement(me,null),C().createElement(ye,null),C().createElement(me,null),C().createElement(ee,{options:t,onOptionsChange:e=>{r(_e(Oe({},e),{jsonData:_e(Oe({},e.jsonData),{authenticationType:e.jsonData.authenticationType,oauthPassThru:e.jsonData.authenticationType===ce.ForwardOAuthIdentity})}))},authOptions:de,showServiceAccountImpersonationConfig:o}),n.authenticationType===

After making the changes:

unction*(){var e;const t=yield this.callHealthCheck();if("error"===(null===(e=t.status)||void 0===e?void 0:e.toLowerCase()))return Promise.reject({status:"error",message:t.message,error:new ae.HealthCheckError(t.message,t.details)});const r=yield y_(this.uid);try{yield r.getProjects()}catch(e){var n,o,i;return Promise.reject({status:"error",message:(null===(n=e.data)||void 0===n?void 0:n.message)||"Error connecting to resource manager.",error:new ae.HealthCheckError(null===(o=e.data)||void 0===o?void 0:o.message,null===(i=e.data)||void 0===i?void 0:i.details)})}return{status:"OK",message:"Data source is working"}}).call(this)}applyTemplateVariables(e,t){const r=(0,ae.getTemplateSrv)().replace(e.rawSql,t,l_);return{refId:e.refId,hide:e.hide,key:e.key,queryType:e.queryType,datasource:e.datasource,rawSql:r,format:e.format,connectionArgs:{dataset:e.dataset,table:e.table,location:e.location,enableStorageAPI:e.enableStorageAPI||!1}}}constructor(e){super(e),aw(this,"instanceSettings",void 0),aw(this,"jsonData",void 0),aw(this,"authenticationType",void 0),aw(this,"annotations",void 0),this.instanceSettings=e,this.annotations={},this.jsonData=e.jsonData,this.authenticationType=e.jsonData.authenticationType||ce.JWT,this.variables={getType:()=>R.VariableSupportType.Custom,editor:nw,getQueryDisplayText:(e)=>{return(e&&e.rawSql)?e.rawSql:“”},query:e=>{const t=e.targets.map(e=>lw(uw({},e),{refId:e.refId||(0,qE.uniqueId)("tempVar")}));return this.query(lw(uw({},e),{targets:t}))}}}}const pw=new R.DataSourcePlugin(cw).setConfigEditor(e=>{const{options:t,onOptionsChange:r}=e,{jsonData:n}=t,o=n.authenticationType===ce.JWT||n.authenticationType===ce.GCE;return C().createElement(C().Fragment,null,C().createElement(ne,{dataSourceName:"Google BigQuery",docsLink:" Google BigQuery plugin for Grafana | Grafana Labs ",hasRequiredFields:!1}),C().createElement(me,null),C().createElement(ye,null),C().createElement(me,null),C().createElement(ee,{options:t,onOptionsChange:e=>{r(_e(Oe({},e),{jsonData:_e(Oe({},e.jsonData),{authenticationType:e.jsonData.authenticationType,oauthPassThru:e.jsonData.authenticationType===ce.ForwardOAuthIdentity})}))},authOptions:de,showSe
/this.variables

It looks like this after the change.

Also, the plugins section and allow_loading_unsigned_plugins setting were not present in the configuration file, so I added them as mentioned below:

[dataproxy]
timeout = 300

[plugins]
allow_loading_unsigned_plugins = grafana-bigquery-datasource

After restarting Grafana, the entire data source stopped working and showed the error:

“Plugin disabled due to modified content”

Please see the attached screenshot for reference.

FYI, from my observations, the issue appears to be related to variables of type Query. It does not seem to matter which data source is selected; the same issue occurs across all data sources.

Thanks again for all your help and support. We look forward to getting this fixed, as without it, it is very difficult to cross-check each and every variable and verify what is being passed internally.

This display functionality is very basic but extremely useful, as it helps save a significant amount of time and effort during validation and troubleshooting.

Thanks for the detailed follow-up. Your patch to module.js is correct → the change looks exactly right.
For the “Plugin disabled due to modified content” error:
The grafana.ini setting is correct but Grafana may not be loading it. Try using the environment variable instead which takes priority:

bash
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=grafana-bigquery-datasource

If using systemd, add it to /etc/sysconfig/grafana-server:
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=grafana-bigquery-datasource

Then restart Grafana.
Regarding your observation that all datasources have this issue → this is a very important finding. Could you confirm which other datasources show definition:""? If it affects all datasources, the root cause may be in Grafana 13’s new dashboard schema serialization rather than the BigQuery plugin specifically

What if you went the provisioning your dashboard route until a fix is provided if it is a bug

This modifying/hack of source code is not a route you want to take.

Hi @infofcc3 , Nope, it didn’t fix the issue and I’m still seeing the same error message.

Current configuration:

# tail -n 2 /etc/sysconfig/grafana-server
PID_FILE_DIR=/var/run/grafana
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=grafana-bigquery-datasource

# tail -n 1 ~/.bashrc
export GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=grafana-bigquery-datasource
# tail -n2 /etc/grafana/grafana.ini
;[plugins]
;allow_loading_unsigned_plugins = grafana-bigquery-datasource

I restarted Grafana after logging out and logging back in, but it still shows:

  • “Plugin signature does not match”
  • “Plugin disabled due to modified content”

Please let me know if there is anything else I should check. Thanks!!

Hi @infofcc3 , @yosiasz , Just following up on this issue, as it is very important for us and has put several tasks on hold. I would appreciate it if you could let us know how we can fix this, whether temporarily or permanently. Any solution is fine for us. We are completely open to rebuilding, redeploying, recompiling the plugin, or making any necessary changes if that helps resolve the issue.

At this point, we are mainly looking for guidance on the correct approach to get this back working again. We look forward to your response and any suggestions you may have.

Thanks again for all your help and support!

Why do you need for that to have a value? Does it break something?

Hi @yosiasz , we are in the process of migrating Grafana versions and without being able to quickly refer to the query definitions, it is very difficult to cross-check everything manually. Thanks

So let’s talk about migration then ;), the real issue. Are you using `sqlite as back end or some other db.

Also how are you doing this?

“without being able to quickly refer to the query definitions, it is very difficult to cross-check everything manually.”

Hi @yosiasz , Yes, we are currently using SQLite and will be migrating to a different database as part of this migration effort.

If I am not mistaken, I already provided a screenshot with a reproducible example using a dummy query. Is this issue related to the backend database in any way?

At the moment, all I am looking for is a way to view the reference query/definition for Query-type variables. Please let me know if you need any additional screenshots or examples, and I will be happy to provide them.Also, if the recommended approach is to temporarily roll back to an older Grafana version to complete the migration in order to show definition , I am okay with doing that as well. My primary goal right now is to start using the native Grafana BigQuery datasource plugin. Once the migration is completed successfully and everything is stable, we can then move to the latest Grafana version.. Thanks.

the goal posts keeps shifting :soccer_ball: with every post :upside_down_face: sorry but wont be able to help you.

GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS doesn’t bypass “Plugin disabled due to modified content” → it only works for unsigned plugins, not modified ones.

A community-reported workaround is to delete MANIFEST.txt after patching, then treat it as unsigned:

bash

rm /var/lib/grafana/plugins/grafana-bigquery-datasource/MANIFEST.txt

Then ensure /etc/grafana/grafana.ini has:

ini

[plugins]
allow_loading_unsigned_plugins = grafana-bigquery-datasource

Restart Grafana:

bash

sudo systemctl restart grafana-server

For your migration use case → extract all variable queries directly from your dashboard JSON without touching any plugins:

bash

grep -o '"rawSql":"[^"]*"' your-dashboard.json

This gives you all SQL queries instantly for cross-checking during migration.

Hi @infofcc3 , Nope, that didn’t fix the issue. Please find the error message below for reference:

(tf213env) [root@abhay-jogekar-build-image-rocky-linux-02 ~]# grep level=error /var/log/grafana/grafana.log
logger=plugin.backgroundinstaller t=2026-06-16T16:37:05.736828973Z level=error msg="Failed to install plugin" pluginId=elasticsearch version= error="unlinkat /usr/share/grafana/data/plugins-bundled/elasticsearch: read-only file system"
(tf213env) [root@abhay-jogekar-build-image-rocky-linux-02 ~]# grep level=error /var/log/grafana/grafana.log
logger=plugin.backgroundinstaller t=2026-06-16T16:37:05.736828973Z level=error msg="Failed to install plugin" pluginId=elasticsearch version= error="unlinkat /usr/share/grafana/data/plugins-bundled/elasticsearch: read-only file system"
(tf213env) [root@abhay-jogekar-build-image-rocky-linux-02 ~]# grep level=error /var/log/grafana/grafana.log
logger=plugin.backgroundinstaller t=2026-06-16T16:37:05.736828973Z level=error msg="Failed to install plugin" pluginId=elasticsearch version= error="unlinkat /usr/share/grafana/data/plugins-bundled/elasticsearch: read-only file system"
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:18.594476156Z level=error msg="error querying the database: googleapi: Error 400: Required parameter is missing: query, required"
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:18.594657278Z level=error msg="Partial data response error" pluginVersion=3.1.5 status=500 statusSource=downstream uname=admin dsName=grafana-bigquery-datasource-1 dsUid=cfpbr48el39j4d endpoint=queryData error="error querying the database: googleapi: Error 400: Required parameter is missing: query, required" pluginId=grafana-bigquery-datasource refID=tempvar
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:18.594736406Z level=error msg="Plugin Request Completed" pluginVersion=3.1.5 statusSource=downstream dsName=grafana-bigquery-datasource-1 dsUid=cfpbr48el39j4d duration=91.296237ms endpoint=queryData pluginId=grafana-bigquery-datasource status=error uname=admin
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:20.519028955Z level=error msg="error querying the database: googleapi: Error 400: Syntax error: Unexpected identifier "s" at [1:1], invalidQuery"
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:20.519205592Z level=error msg="Partial data response error" dsName=grafana-bigquery-datasource-1 error="error querying the database: googleapi: Error 400: Syntax error: Unexpected identifier "s" at [1:1], invalidQuery" pluginId=grafana-bigquery-datasource pluginVersion=3.1.5 refID=tempvar dsUid=cfpbr48el39j4d endpoint=queryData status=500 statusSource=downstream uname=admin
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:20.51929263Z level=error msg="Plugin Request Completed" endpoint=queryData pluginId=grafana-bigquery-datasource uname=admin dsName=grafana-bigquery-datasource-1 dsUid=cfpbr48el39j4d duration=297.315359ms pluginVersion=3.1.5 status=error statusSource=downstream
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:21.394103678Z level=error msg="error querying the database: googleapi: Error 400: Syntax error: Unexpected identifier "se" at [1:1], invalidQuery"
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:21.394260237Z level=error msg="Partial data response error" endpoint=queryData error="error querying the database: googleapi: Error 400: Syntax error: Unexpected identifier "se" at [1:1], invalidQuery" pluginVersion=3.1.5 refID=tempvar status=500 pluginId=grafana-bigquery-datasource statusSource=downstream uname=admin dsName=grafana-bigquery-datasource-1 dsUid=cfpbr48el39j4d
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:21.394347481Z level=error msg="Plugin Request Completed" pluginId=grafana-bigquery-datasource pluginVersion=3.1.5 statusSource=downstream uname=admin dsName=grafana-bigquery-datasource-1 status=error dsUid=cfpbr48el39j4d duration=260.957763ms endpoint=queryData
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:21.555345799Z level=error msg="error querying the database: googleapi: Error 400: Syntax error: Unexpected identifier "sel" at [1:1], invalidQuery"
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:21.555511652Z level=error msg="Partial data response error" dsName=grafana-bigquery-datasource-1 dsUid=cfpbr48el39j4d endpoint=queryData error="error querying the database: googleapi: Error 400: Syntax error: Unexpected identifier "sel" at [1:1], invalidQuery" refID=tempvar pluginId=grafana-bigquery-datasource pluginVersion=3.1.5 status=500 statusSource=downstream uname=admin
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:21.555599508Z level=error msg="Plugin Request Completed" duration=234.791915ms pluginId=grafana-bigquery-datasource statusSource=downstream endpoint=queryData pluginVersion=3.1.5 status=error uname=admin dsName=grafana-bigquery-datasource-1 dsUid=cfpbr48el39j4d
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:21.614528824Z level=error msg="error querying the database: googleapi: Error 400: Syntax error: Unexpected identifier "sele" at [1:1], invalidQuery"
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:21.614698931Z level=error msg="Partial data response error" uname=admin endpoint=queryData error="error querying the database: googleapi: Error 400: Syntax error: Unexpected identifier "sele" at [1:1], invalidQuery" refID=tempvar status=500 statusSource=downstream dsName=grafana-bigquery-datasource-1 dsUid=cfpbr48el39j4d pluginId=grafana-bigquery-datasource pluginVersion=3.1.5
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:21.614784923Z level=error msg="Plugin Request Completed" duration=195.386481ms endpoint=queryData status=error statusSource=downstream uname=admin dsName=grafana-bigquery-datasource-1 dsUid=cfpbr48el39j4d pluginId=grafana-bigquery-datasource pluginVersion=3.1.5
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:22.005508161Z level=error msg="error querying the database: googleapi: Error 400: Syntax error: Unexpected identifier "selec" at [1:1], invalidQuery"
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:22.005667029Z level=error msg="Partial data response error" error="error querying the database: googleapi: Error 400: Syntax error: Unexpected identifier "selec" at [1:1], invalidQuery" pluginVersion=3.1.5 refID=tempvar status=500 endpoint=queryData pluginId=grafana-bigquery-datasource statusSource=downstream uname=admin dsName=grafana-bigquery-datasource-1 dsUid=cfpbr48el39j4d
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:22.005796291Z level=error msg="Plugin Request Completed" dsName=grafana-bigquery-datasource-1 dsUid=cfpbr48el39j4d pluginId=grafana-bigquery-datasource pluginVersion=3.1.5 statusSource=downstream uname=admin duration=194.235033ms endpoint=queryData status=error
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:22.194267972Z level=error msg="error querying the database: googleapi: Error 400: Syntax error: Unexpected end of script at [1:7], invalidQuery"
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:22.194425594Z level=error msg="Partial data response error" endpoint=queryData error="error querying the database: googleapi: Error 400: Syntax error: Unexpected end of script at [1:7], invalidQuery" status=500 uname=admin dsUid=cfpbr48el39j4d pluginId=grafana-bigquery-datasource pluginVersion=3.1.5 refID=tempvar statusSource=downstream dsName=grafana-bigquery-datasource-1
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:22.194512804Z level=error msg="Plugin Request Completed" dsUid=cfpbr48el39j4d endpoint=queryData pluginVersion=3.1.5 status=error dsName=grafana-bigquery-datasource-1 duration=204.393909ms pluginId=grafana-bigquery-datasource statusSource=downstream uname=admin
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:22.526090131Z level=error msg="error querying the database: googleapi: Error 400: Syntax error: Unexpected end of script at [1:7], invalidQuery"
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:22.526394021Z level=error msg="Partial data response error" dsName=grafana-bigquery-datasource-1 endpoint=queryData error="error querying the database: googleapi: Error 400: Syntax error: Unexpected end of script at [1:7], invalidQuery" pluginId=grafana-bigquery-datasource pluginVersion=3.1.5 refID=tempvar statusSource=downstream dsUid=cfpbr48el39j4d status=500 uname=admin
logger=plugin.grafana-bigquery-datasource t=2026-06-16T16:39:22.526448679Z level=error msg="Plugin Request Completed" duration=150.834595ms pluginId=grafana-bigquery-datasource pluginVersion=3.1.5 status=error dsName=grafana-bigquery-datasource-1 dsUid=cfpbr48el39j4d endpoint=queryData statusSource=downstream uname=admin ..

This time the datasource is working, but the query definition field is missing again.

code changes:

Promise.resolve(t)})()}testDatasource(){return iw(function*(){var e;const t=yield this.callHealthCheck();if("error"===(null===(e=t.status)||void 0===e?void 0:e.toLowerCase()))return Promise.reject({status:"error",message:t.message,error:new ae.HealthCheckError(t.message,t.details)});const r=yield y_(this.uid);try{yield r.getProjects()}catch(e){var n,o,i;return Promise.reject({status:"error",message:(null===(n=e.data)||void 0===n?void 0:n.message)||"Error connecting to resource manager.",error:new ae.HealthCheckError(null===(o=e.data)||void 0===o?void 0:o.message,null===(i=e.data)||void 0===i?void 0:i.details)})}return{status:"OK",message:"Data source is working"}}).call(this)}applyTemplateVariables(e,t){const r=(0,ae.getTemplateSrv)().replace(e.rawSql,t,l_);return{refId:e.refId,hide:e.hide,key:e.key,queryType:e.queryType,datasource:e.datasource,rawSql:r,format:e.format,connectionArgs:{dataset:e.dataset,table:e.table,location:e.location,enableStorageAPI:e.enableStorageAPI||!1}}}constructor(e){super(e),aw(this,"instanceSettings",void 0),aw(this,"jsonData",void 0),aw(this,"authenticationType",void 0),aw(this,"annotations",void 0),this.instanceSettings=e,this.annotations={},this.jsonData=e.jsonData,this.authenticationType=e.jsonData.authenticationType||ce.JWT,this.variables={getType:()=>R.VariableSupportType.Custom,editor:nw,getQueryDisplayText:(e)=>{return(e&&e.rawSql)?e.rawSql:""},query:e=>{const t=e.targets.map(e=>lw(uw({},e),{refId:e.refId||(0,qE.uniqueId)("tempVar")}));return this.query(lw(uw({},e),{targets:t}))}}}}const pw=new R.DataSourcePlugin(cw).setConfigEditor(e=>{const{options:t,onOptionsChange:r}=e,{jsonData:n}=t,o=n.authenticationType===ce.JWT||n.authenticationType===ce.GCE;return C().createElement(C().Fragment,null,C().createElement(ne,{dataSourceName:"Google BigQuery",docsLink:"https://grafana.com/grafana/plugins/grafana-bigquery-datasource/",hasRequiredFields:!1}),C().createElement(me,null),C().createElement(ye,null),C().createElement(me,null),C().createElement(ee,{options:t,onOptionsChange:e=>{r(_e(Oe({},e),{jsonData:_e(Oe({},e.jsonData),{authenticationType:e.jsonData.authenticationType,oauthPassThru:e.jsonData.authenticationType===ce.ForwardOAuthIdentity})}))},authOptions:de,showServiceAccountImpersonationConfig:o}),n.authenticationType===ce.ForwardOAuthIdentity&&C().createElement(N.Field,{label:"Default project"},C().createElement(N.Input,{id:"d
"/var/lib/grafana/plugins/grafana-bigquery-datasource/module.js" 64L, 883567B                          

Thanks for taking the time to help us. It is greatly appreciated and I am grateful for your support.

Your patch is correctly applied and datasource is working → great progress

To confirm why definition is still empty, please share your exported dashboard JSON variable section → specifically whether it shows kind: QueryVariable or the classic type: query format.

This will tell us if the issue is Grafana 13’s new dashboard schema not calling getQueryDisplayText at all.

Thanks @infofcc3 .

Please find the attached two files:

  1. dashboard-1781696975873.json – V2 Resource JSON file

  2. bq-test-dashborad-1781697002532.json – Classic JSON file

FYI, this is a brand-new dashboard and does not contain anything other than a BigQuery variable called bq_var_01.

The variable uses the query:

SELECT 1

The output correctly shows 1 below. However, the Definition field is still empty, which is the issue I have been observing.

I hope these files help reproduce the problem. Please let me know if you need any additional examples or information me. Thanks and regards

dashboard-1781696975873.json (3.5 KB)

bq-test-dashborad-1781697002532.json (2.1 KB)