Connect to Google BigQuery

Connect Data Studio to BigQuery tables.

BigQuery is Google's fully managed, petabyte scale, low-cost analytics data warehouse. The Data Studio BigQuery connector allows you to access data from your BigQuery tables within Data Studio.

BigQuery is a paid product and you will incur BigQuery usage costs when accessing BigQuery through Data Studio.
In this article:

How to connect to BigQuery

You can can connect Data Studio to a single Google BigQuery table or view:

To connect

  1. Sign in to Data Studio.
  2. In the top left, click Create, then select Data Source.
  3. Select the BigQuery connector.
  4. Select a connection option (described below) and provide your connection details.
  5. In the upper right, click CONNECT.
    1. The data source fields panel appears.
    2. The data source is now connected to your data set.

Connection options

When creating a BigQuery data source, you can choose from the following options:

Recent projects

Use this option to find a project you've accessed recently in the GCP Cloud Console.

My projects

Use this option to select a full table in a project to which you have access. The data source editor allows you to traverse the Project, Data Set, and Table hierarchy.

Shared projects

Use this to access a shared data set, and use a different project for billing purposes.

To connect to a shared project:

  1. Select a billing project.
  2. Enter the shared project name.
  3. Select a data set and table.
  4. Click CONNECT.

Custom query

Select the CUSTOM QUERY option to provide a SQL query instead of connecting to a single table. Data Studio uses this custom SQL as an inner select statement for each generated query to the database.

To use Custom Query, first select a project you have access to. This will be used for billing purposes. Next, input your SQL query.

Custom query syntax

The custom query syntax follows the Standard SQL dialect.

To use the legacy BigQuery SQL dialect, check Use Legacy SQL.

You can use the BigQuery user interface to test that your query works, then copy and paste that query into Data Studio.

Query parameters

Parameters let you build more responsive, customizable reports. You can pass parameters in a BigQuery data source back to the underlying query. To use a parameter in your custom query, follow the syntax guidelines described for running parameterized queries in BigQuery.

Standard parameters

You can use the following parameters in any custom query:




Sets the beginning of the query time frame.


Sets the end of the query time frame.


Passes in the email address of the logged-in user.

To use these parameters:

  1. Below the query editor, turn on the parameters you want to use.

    1. You'll be prompted grant access to your email address when you turn on the @DS_USER_EMAIL parameter.

  2. In your query, be sure to use uppercase for the parameter names.

All parameter values are passed to BigQuery as strings. To handle them as dates, numbers, or other data types in BigQuery, be sure to use an appropriate conversion function, such as PARSE_DATE , PARSE_TIMESTAMP, or CAST.

Use date parameters to pass date ranges to the underlying query

If your report includes a date range control, viewers can use that to request different starting and ending dates from the BigQuery data.

Use the email parameter to provide row-level access to the data

The email parameter lets you show only the data associated with the logged-in user of a report, data source, or exploration. That user must be logged in to a Google account and must consent to providing their email address to Data Studio. If the viewer doesn't consent, all charts in the report based on this data source will display an authorization error.

Custom parameters

You can use any parameters you create in the Data Studio user interface in your custom query.

Create a parameter in the BigQuery connection page

  1. Below the custom query editor, click +ADD PARAMETER.
  2. Configure the parameter options.
  3. Click OK.

Hide custom parameters in the data source

By default, custom parameters can be modified in reports. To prevent report editors from changing a parameter's value, you can hide the parameter.

  1. To the right of the parameter, click More options More menu.
  2. Click Hide.

Learn more about allowing data source parameters in reports.

Use a parameter in a custom query

In the body of your custom query, replace a hard-coded value with an identifier beginning with the @ character. For example: @param_name.

Parameter examples

Custom parameter example:

SELECT word FROM `TABLE` WHERE corpus = @corpus;

Use a string with contains and a number:



AND attendance > @attendance LIMIT 100;

Use a multi-select string parameter. Note the use of UNNEST to flatten the list of values:

SELECT * from user.users as user WHERE display_name in UNNEST(@name);

Date parameter example:

SELECT creation_date, age, display_name from user.users as user

WHERE creation_date > PARSE_DATE('%Y%m%d', @DS_START_DATE)

AND creation_date < PARSE_DATE('%Y%m%d', @DS_END_DATE);

Email parameter example:

Select * from Sales WHERE sales-rep-email = @DS_USER_EMAIL;

Public datasets

You can use this option to access BigQuery public datasets. BigQuery offers a number of public samples, where the dataset is shared, but not the project. To query this data, you must specify your own project, which will be used to bill for processing costs on the shared data.

Advanced options

Override Billing Project ID

Specify a different Billing Project ID for this custom query.

Configuration options

Use _PARTITIONTIME as time dimension

This option appears when you select a date-partitioned table. By default, the data source uses the table's partition time as the date range dimension. Uncheck this option to use explicit date fields in the table as the date range dimension. Learn more about date-partitioned tables in BigQuery.

Google data integrations

Some Google products export data directly into BigQuery tables. When recognized, Data Studio will automatically enrich the fields to include common aggregations, calculations, and field names.

Google Analytics BigQuery export

When Data Studio encounters a table generated by Google Analytics BigQuery Export, the table will have a Google Analytics icon next to it. When selected, many of the common metrics found in Google Analytics will automatically be created as Data Studio fields.

BigQuery BI Engine

BigQuery BI Engine is a fast, in-memory analysis service. By using BI Engine, you can analyze data stored in BigQuery with sub-second query response time and with high concurrency. You can accelerate your reports and explorations by connecting Data Studio to a BigQuery table managed by BI Engine.

BI Engine offers up to 1 GB of free capacity to Data Studio users.

Get started using Data Studio with BI Engine.

Configure the data source

The data source fields panel is where you configure the data source by renaming fields and adding descriptions, adding calculated fields, and changing data types and aggregations. Learn more about working with data source fields.

Control who sees the data

At the top of the fields panel, you can change the data credentials. Credentials control who can see the data provided by this data source.

OWNER'S CREDENTIALS lets other people view or create reports that use this data without requiring them to have their own access to the data set.

VIEWER'S CREDENTIALS, on the other hand, requires each user of the data source to provide their own credentials to access the data set.

Learn more about data credentials.

Create a new report from the data source

  1. In the upper right, click CREATE REPORT.
    1. The report editor appears.
  2. Click ADD TO REPORT.
    1. This adds the data source to report.
    2. You can now create charts and controls that get their data from this data source.

New to Data Studio?

Take the Create a report tutorial. Or learn more about the report editor.


BigQuery is a paid product and you will incur BigQuery usage costs when accessing BigQuery through DataStudio. Data Studio will issue queries to BigQuery during report editing, report caching, and occasionally during report viewing.

Learn more about setting up a BigQuery billing account.

Multi-day Tables

BigQuery supports querying across multiple tables, where each table has a single day of data. The tables have the format of YYYYMMDD. When Data Studio encounters a table that has the format of YYYYMMDD, the table will be marked as a multi-day table and only the name prefix_YYYYMMDD will be displayed in the table select.

When a chart is created to visualize this table, Data Studio will automatically create a default date range of the last 28 days, and properly query the last 28 tables. You can configure this setting by editing the report, selecting the chart, then adjust the Date Range properties in the chart's DATA tab.


To speed up the user experience, Data Studio Reports will try to fetch data from the cache. The BigQuery cache expires every 12 hours by default. Refreshing the cache can incur BigQuery costs.

Caching and Report Viewing

Once the data is cached, when a report is viewed, Data Studio will try to access the data from cache, and therefore minimize BigQuery costs.

Caching is a best effort feature and might not always be possible depending on query response size.

Learn more about the cache.

Viewing SQL issued to BigQuery

You can view all the BigQuery SQL Data Studio generates from within the BigQuery Query History user interface.

Record Count metric

BigQuery data sources automatically provide a default Record Count metric. You can use this to breakdown your dimensions to show the number of records being aggregated by your charts.

Quotas and limits

BigQuery data sources are subject to the same rate limits and quota limits as BigQuery itself.

Support for VPC Service Controls

Data Studio can connect to BigQuery projects protected by VPC Service Control perimeters via viewer IP-based access levels.

Visualize BigQuery GEOGRAPHY polygons

You can display GEOGRAPHY polygons using a Google Maps visualization in your report. Click here for a tutorial.

Was this helpful?
How can we improve it?