Search code examples
google-bigquerylooker-studio

Datastudio BigQuery connector: The query returned an error


When creating a BigQuery data connector for Google Data Studio, my query works until I attempt to parameterize some fields. As soon as I add parameters, I get the unhelpful and unspecific error:

The query returned an error.
Error ID: xyz

How can I figure out what the underlying issue is that is causing this problem?


Solution

  • 1. Check BigQuery Logs in Cloud Logging

    If there is an error executing a query in BigQuery, the underlying cause will likely be visible in Cloud Logging. In Cloud Logging, execute this query to show these errors, and hopefully get insight into the underlying problem:

    resource.type="bigquery_resource"
    severity=ERROR
    

    Its possible these logs will show that the query is failing because the format of certain data is invalid -- in that case its likely because having no default values for parameters is preventing the BigQuery query from succeeding. In that case:

    2. Give Parameters Default Values

    The connector passes the query to BigQuery, which executes it. In order for this to work correctly, the parameters need to have some values. Provide them in the form of parameter default values that will result in a valid query.