> For the complete documentation index, see [llms.txt](https://datalab-docs.datacamp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://datalab-docs.datacamp.com/connect-to-data/bigquery.md).

# Google BigQuery

## Set up a BigQuery warehouse

If you already have a BigQuery warehouse set up, you can skip this step.

* Visit <https://console.cloud.google.com>
* In the search bar, look for BigQuery
* Go through one of the guides to "Add your own data".
* You can test that things work by querying the resulting dataset table.

<figure><img src="https://4179539225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZqboFGZzD87nn7oPsm%2Fuploads%2FikSeELaT4MmpuFHmgydo%2FScreenshot%202023-09-07%20at%2012.09.53.png?alt=media&amp;token=c20411fc-bcc9-435d-801e-65362785a76f" alt=""><figcaption></figcaption></figure>

#### Configure a Google Service Account

A Google service account is a special kind of account that can be used by programs to access Google resources like a BigQuery data warehouse. You will use this service account to connect DataCamp DataLab to your BigQuery warehouse.

To set up a new Google Service Account, please refer to [this excellent guide](https://docs.openbridge.com/en/articles/1856793-how-to-set-up-google-bigquery-creating-and-configuring-service-accounts-in-google-cloud-console). At the end of it, you'll have the JSON credentials file that you can use to set up the BigQuery connection in DataLab.

## Set up a Google BigQuery connection

When inside a workbook, click **View** > **Databases**, then click the **+** icon and follow the on-screen instructions. Upload the Service Account JSON and hit "Connect".

<figure><img src="https://4179539225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZqboFGZzD87nn7oPsm%2Fuploads%2FvPhZPabEMDDIKGEYusXa%2FScreenshot%202023-06-30%20at%2014.00.36.png?alt=media&amp;token=1dc8ef57-132b-4b7e-bbe6-867f815c5452" alt=""><figcaption><p>Create a BigQuery connection</p></figcaption></figure>

For detailed instructions, see [Connect your data to DataLab](/connect-to-data/connect-your-data-to-workspace.md).

## Query the database

You can now query the BigQuery data warehouse with a [SQL cell](/work/sql-cell.md). Select it in the **Select source** dropdown in the top left corner of a SQL cell, or select the sample BigQuery data warehouse.

<figure><img src="https://4179539225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZqboFGZzD87nn7oPsm%2Fuploads%2FO7KaPelnOrGiGFLeDFvg%2Fimage.png?alt=media&amp;token=6448a3ec-095f-4c98-8c46-565d5ea01e4c" alt=""><figcaption><p>Example of a SQL cell using the <code>BigQuery Integration</code> connection. The query result is available as <code>df</code>.</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://datalab-docs.datacamp.com/connect-to-data/bigquery.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
