BigQuery
Included in all plans
Wren AI needs to access your BigQuery database via the IP address of the outbound IP of Wren AI Cloud. If you had applied network access controls on top of BigQuery, please add the IP address of the Wren AI service to the allowed IP list.
Scroll to the bottom of the data source connection page to find the IP address.
To add a BigQuery connection, click on the BigQuery option in Connect a data source section.
Prerequisites
Google Cloud Platform
You'll need a Google Cloud Platform account with a project that you plan to use in Wren AI. Refer to the Google Cloud Platform's documentation about creating and managing projects. Ensure this project has a BigQuery dataset for Wren AI to connect to.
Prepare your service account and JSON key file
You'll first need to prepare a service account JSON key file for Wren AI to access your BigQuery dataset. Service accounts are used by an applications (such as Wren AI) to make authorized API calls.
Follow the instructions on Google's documentation to create a service account and create a service account key. Here's the basic flow:
1. Create a service account
Go to the IAM & Admin section from the sidebar menu of your Google Cloud Platform project console, and select Service account.
Click on the + CREATE SERVICE ACCOUNT on the top.
2. Service account details
Name your service account and add a description.
3. Grant this service account access to project
Grant 2 roles for Wren AI to view and run queries against your dataset (See BigQuery IAM roles and permissions for more information):
- BigQuery Data Viewer
- BigQuery User
Click Done to finish creating the service account.
4. Create a service account key
Click the service account you just created, and go to the Keys tab.
Click the Add key drop-down menu, then select Create new key.
Select JSON as the Key type and click Create.
The JSON file will download to your computer.
You can only download the key once. If you delete the key, you'll need to create another service account with the same roles.
Connect
Fill in the connection settings:
Display name
The display name for the database in the Wren AI interface.
Project ID
Each BigQuery dataset is associated with a Project ID. If you're unsure where to find the Project ID, refer to Google's documentation for instructions on accessing dataset information.
Dataset ID
Specify which BigQuery dataset you want to connect by filling in the Dataset ID. If you're unsure where to find the Dataset ID, refer to Google's documentation for instructions on accessing dataset information.
Credentials (Service account JSON file)
Upload the JSON key file created from your service account.
The JSON key file includes the credentials required for Wren AI to access BigQuery datasets. See Prerequisites for instructions on preparing your service account and JSON key file.
Click Next to start connection and go to the next step.
Select Tables
All tables of your connected BigQuery dataset will be listed in this step. Select which tables you want to use in Wren AI. Each selected table will be created as a data model. See the Modeling documentations to learn more about what is data models.
Define relationships
Define the relationships among selected tables in this step. If you have defined primary keys and foreign keys in your BigQuery dataset, we will list suggested relationships based on the information. If not, you can also add relationships by clicking the Add relationships button on the table blocks.
Define following properties in a relationship:
- From: Select the left side table and column of this relationship.
- To: Select the right side table and column of this relationship.
- Relationship Type: Select the type of relationship.
Find more information about relationship in Modeling - Working with Relationships
You can also skip this step and finish connection.