# BigQuery

### Prerequisites

Before setting up the integration, make sure you have:

* A **Google Cloud Platform (GCP)** account
* A **BigQuery project and dataset**
* Permissions to create **service accounts and keys** in Google Cloud
* Access to your **Optibase workspace settings**

***

## Step 1: Create a BigQuery Dataset

1. Go to **Google Cloud Console**
2. Navigate to **BigQuery**
3. Select your **Project**
4. Click **Create Dataset**
5. Enter the following details:

| Field         | Value                                |
| ------------- | ------------------------------------ |
| Dataset ID    | Choose a name (e.g. `optibase_data`) |
| Data location | Choose your preferred region         |

6. Click **Create dataset**

***

## Step 2: Create a Service Account

1. Open **Google Cloud Console**
2. Navigate to **IAM & Admin**
3. Click **Service Accounts**
4. Click **Create Service Account**

Fill in:

| Field                | Value                                             |
| -------------------- | ------------------------------------------------- |
| Service account name | `optibase-bigquery-sync`                          |
| Description          | Service account used for Optibase BigQuery export |

Click **Create and Continue**

***

## Step 3: Grant Required Permissions

Assign the following role to the service account:

* **BigQuery Data Editor**

This allows Optibase to write experiment data into your dataset.

Click **Continue**, then **Done**.

***

## Step 4: Create and Download the Service Account Key

1. Go to the **Service Account** you just created
2. Open the **Keys** tab
3. Click **Add Key**
4. Select **Create new key**
5. Choose **JSON**
6. Click **Create**

A JSON key file will be downloaded to your computer.

You will use this file to authenticate Optibase with BigQuery.

***

## Step 5: Configure BigQuery Sync in Optibase

1. Log in to **Optibase**
2. Navigate to:

**Workspace Settings → Integrations → BigQuery**

3. Click **Connect BigQuery**

Fill in the following fields:

| Field                | Description                         |
| -------------------- | ----------------------------------- |
| Project ID           | Your Google Cloud project ID        |
| Dataset ID           | The dataset you created earlier     |
| Service Account JSON | Upload the downloaded JSON key file |

4. Click **Save**

***

## Step 6: Verify the Connection

After saving the integration:

1. Optibase will validate the credentials
2. If successful, the BigQuery connection will be activated
3. Data exports will begin automatically based on your workspace configuration

New experiment and analytics data will start appearing inside your **BigQuery dataset tables**.

***

## Data Available in BigQuery

The BigQuery export includes:

* Experiment impressions
* Experiment conversions
* Visitor identifiers
* Variant assignments
* Event timestamps
* Experiment metadata

This allows you to combine Optibase data with your internal analytics and BI tools.

***

## Troubleshooting

#### Permission errors

Make sure the service account has:

**BigQuery Data Editor**

access to the dataset.

#### Dataset not found

Verify that the **Dataset ID** and **Project ID** are correct.

#### Invalid JSON key

Ensure you upload the **original JSON key file** generated in Google Cloud.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.optibase.io/integrations/bigquery.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
