# Velo: Integrate Your Google Cloud BigQuery Database with Your Wix Site

Source: https://support.wix.com/en/article/integrate-your-google-cloud-bigquery-database-with-your-wix-site (updated 2024-06-04)
Related: Wix developer documentation, https://dev.wix.com/docs/llms.txt; Help Center index, https://support.wix.com/en/llms.txt

Wix data gives you powerful data storage and retrieval capabilities and the ability to create and maintain your own data collections. But what if you have your own database already, or want to host your data on a relational database? 

  
 With External Database Collections, you can use your BigQuery database hosted on Google Cloud Platform, and fully integrate it into your Wix site. You can use any of the [wix-data](https://www.wix.com/velo/reference/api-overview) and [wix-dataset](https://www.wix.com/velo/reference/wix-dataset) APIs with External Database Collections, as well as connect [repeaters](https://support.wix.com/en/article/cms-displaying-dynamic-content-in-a-repeater), [tables](https://support.wix.com/en/article/cms-formerly-content-manager-displaying-collection-content-in-a-table), and other page elements to your BigQuery data.

  
 To integrate a MySQL or Postgres Database, see [Integrate Your Google Cloud MySQL or Postgres Database with Your Wix Site](https://support.wix.com/en/article/velo-integrate-your-google-cloud-platform-databases-with-your-wix-site). If you want to do this with AWS, see [Integrate Your AWS MySQL Database with Your Wix Site](https://support.wix.com/en/article/velo-integrate-your-aws-databases-with-your-wix-site). For Microsoft Azure, see [Integrate your Azure Database with your Wix Site](https://support.wix.com/en/article/velo-integrate-your-microsoft-azure-database-with-your-wix-site).

## Overview

This tutorial walks you through setting up a BigQuery database on Google Cloud Platform (GCP) and connecting it to your Wix site.

  
 If you don't already have your own database on GCP, we'll help you create one.

  
 Here's what's involved:

  
1. Set up a new project on Google Cloud Platform.
2. Create a BigQuery database, if you don't already have one.
3. Create a new table in your database.
4. Create secrets to securely store your database credentials.
5. Create and deploy a new Cloud Run service to host the Wix database adaptor.
6. Connect your Wix site to your database.

  
 This tutorial uses a container image with all the functionality needed to interface between your database and your Wix site. If you want to look under the hood, you can have a look at the [SPI specifications](https://www.wix.com/velo/reference/spis/external-database-collections) for external database collections, and an overview of what's involved in [building your own adaptor](https://support.wix.com/en/article/velo-integrating-external-databases-with-your-wix-site).

## Google Cloud Platform

This tutorial assumes a bit of knowledge about Google Cloud Platform. If you've never worked with GCP, have a look at [this guide](https://cloud.google.com/free/) and click the **Get Started For Free** button.

  
 Once you're ready to go, create a new project for this tutorial and call it **velo-external-db**.

## Create and Configuring a Database

This part of the tutorial walks you through setting up a BigQuery database and adding a table. If you already have your own database on GCP, you can skip this section. Note that if you want read-write access to your database tables, they must contain the 4 columns described in the [Create a New Database Table](https://support.wix.com/en/article/velo-integrate-your-google-cloud-platform-databases-with-your-wix-site#create-a-new-database-table) section.

## Set Up a BigQuery Database on GCP

**Show me how**

Once you have a GCP account and project set up, create a new dataset with BigQuery:

  
 1\. Open the [BigQuery](https://console.cloud.google.com/bigquery) page in the cloud console. 

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/09/1599ff20-0307-4c61-b0e7-a01570213e86/022027a8-1acb-4775-a13f-b3653803f256.png) 
  
  
 2\. In the **Explorer** panel, select the project where you want to create a dataset. 

 3\. Click **View actions** ![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/09/efb75e52-e21e-459b-8eac-eeccc1853bb6/3ce54b16-a9cb-4be9-bf31-659d7d2dafb5.png) and select **Create dataset.** 

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/09/a0369636-7f7d-4ef7-89af-8aeac38b6847/d98f4324-7162-48b3-a49f-041a4fb1d3c6.png) 
  
  
 4\. On the **Create dataset** page:

 a. For **Dataset ID**, enter a unique dataset name. For this tutorial, we set the Dataset ID to **bigQuery\_dataset**.

 b. For **Data location**, choose a geographic location for the dataset. Note that after a dataset is created, the location can't be changed.

 5\. Click **Create Dataset.** 

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/09/d6a1508d-a31d-4fd1-8949-f361c88f8ec6/3c383457-823a-48f0-8aec-89727d00982a.png)

## Create a New Database Table

This section walks you through creating a new table in BigQuery. If you know what you're doing, or you already have tables and don't want write access, you can skip this section.

> **Prerequisites for Read-Write Access to Your Database Table:** If you want your table to be read-write on your Wix site, it must contain the following columns:
>
> * **\_id**
> * **\_createdDate**
> * **\_updatedDate**
> * **\_owner**
>
>   
>  Tables without these columns will be read-only in your Wix site.

**Show me how**

1\. In the **Explorer** panel, click **View actions** ![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/09/1c275014-015a-4eaa-82ff-12367fa37c1e/0a34c1a7-2d57-44bb-81f3-9e08daccd381.png) and select **Create table.** 

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/09/9dbc5591-2a7f-4394-84cd-21639d9460dc/93ac7f85-d57c-491f-9d05-dc0f3bd344ce.png) 
  
  
 2\. Under **Create table from**, select **Empty table**.

 3\. Under **Table**, enter a name for your table. For this tutorial, we set the Table name to **Contacts**. 

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/09/2f6f36d6-b183-4a49-b7fe-ee47921e1304/9d7f1ccc-ab75-4cd3-b125-5581f53134e1.png) 
  
  
 4\. Make sure your table is located in the correct dataset and project. 

 5\. Under **Schema**, click **Add Field.** 

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/09/4e9e1a4b-3e71-4563-bea7-5490a869011f/556ca5fb-79d4-4650-b1e3-18d52a6e31ba.png) 
  
  
 6\. Add the following fields to your table: 

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/03/15c13211-d6cc-433a-a879-50f579d8a46b/739c2779-d7a4-41bd-9190-b238c9d096bb.png) 

 \*\* Note that the Max length field is optional \*\* 

  
 5\. Click **Create Table.** 

 6\. Check that the table was created. In the **Explorer** panel, expand your dataset. There should now be a table called Contacts.

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/09/d7c47c48-0478-46e5-bc80-ab381a8c16fb/9f877bde-a2e5-492b-8f1c-99f81a3baecb.png) 
  
  
 You can also create a new BigQuery table using [Google's Standard SQL](https://cloud.google.com/bigquery/docs/reference/standard-sql/introduction):

  
 1\. In the BigQuery workspace, click **Compose New Query**.

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/09/d703e83f-f29c-4c13-8363-d0085fcf3640/decd98fd-7634-4056-b5a9-4c72e935c4b3.png) 
  
  
 2\. In the **Editor**, enter the code below to create the table. 

 If you are using a previously existing database, use that database's name instead of 'bigQuery\_dataset'. 

  
 CREATE TABLE bigQuery\_dataset.Contacts(

 \`\_id\` STRING(50) NOT NULL,

 \`\_createdDate\` timestamp,

 \`\_updatedDate\` timestamp,

 \`\_owner\` STRING(50),

 \`name\` STRING(30),

 \`email\` STRING(30),

 \`phone\` STRING(15),

 );

  
 3\. Click **Run**. 

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/09/ed73d1d3-5a08-48d3-94ee-e247333c38a8/4bb021b0-d13d-474d-b4e9-1b948b55a1ef.png) 
  
  
 4\. Check that the table was created. In the **Explorer** panel, expand your dataset. There should now be a table called Contacts.

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/09/49867574-d255-4988-be27-f9e259b06468/b4189da7-31d9-41f7-9a94-91ee00a1236e.png)

---

## Set Up Secrets

The external database adaptor requires you to set some environment variables. Some of these variables, like the DB credentials, are sensitive and should not be visible. We'll use the GCP Secret Manager to store and access these variables securely.

  
 We need to store the following secret values:

* **DATABASE\_ID**  
The BigQuery dataset ID. When we created our database in the previous steps, we set the dataset ID to bigQuery\_dataset.
* **PROJECT\_ID**  
 The ID of the project your dataset is in. You can find this on the **Explorer** panel. ![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/09/677a8d07-2f5b-4e7f-89ea-cdb913e1f3fb/6a959109-0d7b-49e8-ae90-7e983115444d.png)

  
* **SECRET\_KEY**  
 A secret key that is used when connecting your Wix site to the adaptor. To create a level of authentication between your site and the adaptor, each request your site sends to the adaptor contains this value in the payload.
* **PERMISSIONS (optional)** A JSON object that defines the read and write permissions for the tables in your database.  
**Note:** Customizing permissions for external databases is currently a developer preview feature, and may change. Changes to permissions settings are not reflected in the Wix Editor.

**Learn more about configuring database permissions**

By default, only site Admins can read and write to external databases on Wix sites. You can use the **PERMISSIONS** secret to customize the permission settings for each table in a database. The JSON object contains one key, **collectionPermissions**, whose value is an array of objects. Each object in this array contains the permissions settings for one of the collections in the database, using the following parameters:

* **id:** The collection ID.
* **read**: An array of strings representing which roles can read from the collection. Options: ‘Admin’, ’Member', ’Visitor’
* **write**: An array of strings representing which roles can write to the collection. Options: ‘Admin’, ’Member’, ’Visitor’

 Example **PERMISSIONS** value: 

 {

 "collectionPermissions": \[

 {

 "id": "Contacts",

 "read": \["Admin", "Member"\],

 "write": \["Admin"\]

 }

 \]

 }

  
 Note that you can save this object as a .json file and upload it to GCP as the value for the **PERMISSIONS** secret.

## Create Secrets

1\. To create the secrets, go to the GCP [**Secret Manger**](https://console.cloud.google.com/security/secret-manager?project=) page.

 2\. Click **Create Secret**.

![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/99f9f305-0415-4713-856e-b7aa93cbd4d3/2021/10/10/dcb20d7d-454a-4bce-8e1e-025d3585d32f/3801127a-8107-4ddb-980d-e0a377331478.png) 
  
  
 3\. Enter the secret **Name** and **Secret Value** and click **Create Secret**.

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/10/85632e6d-3dff-48f3-bdec-2b0d9954f7f9/08f4cb85-4ddb-4105-9fa2-072ca8bb9584.png) 
  
  
 4\. Repeat steps 1 and 2 for each of the 3 secrets:

* **DATABASE\_ID**
* **PROJECT\_ID**
* **SECRET\_KEY**

  
 5\. To create a **PERMISSIONS** secret, instead of entering a **Secret value**, click **Browse** and select the .json file that contains your permission settings.  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/11fda387-da5a-430a-ada3-46def885b67f/2022/05/11/f4561768-0407-48d4-85e1-393422929aa7/678854d9-2c23-4741-80f0-1f6b7b693aac.png)

## Deploy the Adaptor to Cloud Run

Next, we'll deploy the external database adaptor as a service on Cloud Run. We create the service using a prebuilt container, configure secrets and environment variables, and then configure the database connections.

## Create a Service

1. Go to the[**Cloud Run Instances**](https://console.cloud.google.com/run?project=%5F) page and select your project.
2. Click **Create Service**.

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/99f9f305-0415-4713-856e-b7aa93cbd4d3/2021/09/05/bc6b15a0-5501-4aaf-bce0-e7fa5ecd37f6/74206f12-1b85-47d0-a118-5d3b72e8322b.png) 

  
 3\. Enter **gcr.io/wix-velo-api/velo-external-db** in the **Container Image URL** field. The **Service name** will default to **velo-external-db**.

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/10/7056aff9-dfb8-436b-9ae0-85e6b50d6bf7/3e39bd15-834c-4aea-a455-79fa52f189f7.png) 
  
  
 4\. Uner **Ingress**, select **Allow all traffic**.

 5\. Under **Authentication**, select **Allow unauthenticated invocations**.

 6\. Expand the **Container, Variables & Secrets, Connections, Security** section. 

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/10/94fc5943-ca72-41f3-99a8-a3ca5bf4905c/fb7bf95f-1b1a-42e9-9552-aec8835ff85d.png) 
  
  
 7\. Select **Variables & Secrets**, then click **Add Variable.** 

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/10/96d8e1a3-0d4a-4f4a-b3e7-100ca7a89e14/799d9f18-3dbe-44dd-b2e5-13052b95486d.png) 
  
  
 8\. Create 2 environment variables by clicking **Add Variable** twice. Define the names and values for the variables as follows:

| NAME | VALUE |
| --- | --- |
| TYPE | **bigquery** |
| CLOUD\_VENDOR | **gcp** |

![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/10/e0cdcbbc-787d-4132-b712-eb817851a598/03fcd9cc-8cef-4e9e-bcc5-8cbd39326b84.png) 
  
  
 9\. Click **Create**.

## Configure Access Roles, Secrets, and Environment Variables

Now we configure the secrets that we defined earlier as environment variables for the service. To do this we'll perform the following steps:

1. Create a new service account that will run the Cloud Run service.
2. Grant access roles to the new account.
3. Create environment variables and assign the secrets' values.

### Security Access Roles

1\. On the **Service details** page, click **Edit & Deploy New Version**.

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/10/c2a13f14-7ba1-4e57-871d-59a2e99a0e91/5ee89932-63f1-4f7b-986f-4d97cd7d7958.png) 
  
  
 2\. Select the **Security** tab and then select **Create New Service Account** from the **Service account** dropdown.

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/02/10a4297f-98fa-4388-a003-a18dd735bffa/b7b270e2-d5cb-40ac-880f-0ad561fc34c3.png) 
  
  
 4\. Set the **Service account name**. It is recommended to set the Service account name to match the Cloud Run instance name so that you can easily know which account is used by which instance. 

 5\. Click **Create**.

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/02/b73484b7-1440-4f6f-8a87-b3bb1b1196a3/201d6a57-9f80-4559-93b9-15cc780868a9.png) 
  
  
 6\. Grant the following roles to the service account:

* **BigQueryAdmin**
* **Secret Manager Secret Accessor**

 You can paste the roles above into the dropdown filter.

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/02/15d6f624-1370-4605-a4b6-895b05bec47b/5dca49e4-e96c-4bf0-901f-045018cb47dd.png) 
  
  
 7\. Click **Done**.

### Environment Variables and Secrets

1\. Define the environment variables and assign their values from the secrets that we defined earlier in the [**Create Secrets**](https://support.wix.com/en/article/velo-integrate-your-google-cloud-platform-databases-with-your-wix-site#create-secrets) section.

 2\. In the **Variables & Secrets** tab, click **Reference a Secret**.

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/02/b49c9575-0c89-4574-8c16-3e34ab2916f6/513f17d6-ef45-42f2-ae0d-ff861ab96b01.png) 
  
  
 3\. Select a secret from the **Secret** dropdown and select **Exposed as environment variable** from the **Reference method** dropdown. 

 4\. Assign the environment variable the same name as the secret. 

 5\. Select **latest** from the **Version** dropdown, and click **Done.** 

  
 Repeat this process for all of the secrets that you defined in the [Create Secrets](https://support.wix.com/en/article/velo-integrate-your-google-cloud-platform-databases-with-your-wix-site#create-secrets) section.

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/02/0e9d7efc-c60d-47d2-aec7-b91317f9ba82/d8477533-75f0-4b98-8bfb-cc47800df8e1.png)

> If you get a warning that the service account does not have permissions to access the selected secret, you are no longer configuring the service account that you set up in Step 7 above. 
>
> ![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/99f9f305-0415-4713-856e-b7aa93cbd4d3/2021/09/12/340f24e5-2857-4e40-9b41-bc7f40079687/59c39971-9971-48c6-bea1-2757751b6b46.png) 
>
>  In that case, click the **Security** tab, select your service account from the dropdown, and then return to the **Variables & Secrets** tab.

Once you have configured all of the secrets and environment variables, your configuration looks like this:

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/02/5b9a2d8f-ac67-4bad-80d2-64a295ea1616/c873b9b3-52b6-4ce7-a62e-728bc7b079ff.png) 

  
 6\. Click **Deploy**.

## Check Your Connection Status

Once deployed, check that your setup is working.

  
 1\. From the Cloud Run Service details page, click the service's URL. This URL is used to connect to your database adaptor service and to configure the external collection on your Wix site.

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/02/48a43d1a-1da4-4d4d-b3f3-f0f5609aeeda/9c129a96-4275-49e1-8825-0f2968ba246e.png) 
  
  
 The following page displays **DB Config Status** and **Connection Status** in green. If you added a **PERMISSIONS** secret, the **Permissions Config Status** is also green. If you didn’t, it’s yellow.

  
 If one of the statuses is red, check the configuration, secret values, and environment variables. Make any necessary changes and redeploy the service.

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/11fda387-da5a-430a-ada3-46def885b67f/2022/05/16/c27eb9ec-7b47-4ace-911a-3b24c9d011ef/3d48f101-e0e4-4e20-9898-1b1f82ba55bd.png)

> **Note:** If you change the value of a secret, you must redeploy the service for the new value to take effect.

## Test Your Service

You can test that your service is working by making a quick request using curl.

  
 Use the curl command below, replacing the URL with your URL from Step 2 above, and replacing the **secretKey** value with your secret.

```bash
curl -L -X POST 'https://velo-postgres-db-cacacapca-uc.a.run.app/schemas/list' \
-H 'Content-Type: application/json' \
--data-raw '{
    "requestContext": {
        "settings": {
            "secretKey": "ourLittleSecret"
        },
        "role": "OWNER"
    }
}'
```

The output provides a list of tables and their columns from your database. If you have python installed, you can pipe the output to **python -m json.tool** and it will give you nicely formatted JSON.

 The formatted output contains the list of tables and their columns from your database.

```json
{
    "schemas": [
        {
            "id": "contacts",
            "displayName": "contacts",
            "allowedOperations": [
                "get",
                "find",
                "count",
                "update",
                "insert",
                "remove"
            ],
            "maxPageSize": 50,
            "ttl": 3600,
            "fields": {
                "name": {
                    "displayName": "name",
                    "type": "text",
                    "queryOperators": [
                        "eq",
                        "lt",
                        "gt",
                        "hasSome",
                        "and",
                        "lte",
                        "gte",
                        "or",
                        "not",
                        "ne",
                        "startsWith",
                        "endsWith"
                    ]
                },
                "_createddate": {
                    "displayName": "_createddate",
                    "type": "datetime",
                    "queryOperators": [
                        "eq",
                        "lt",
                        "gt",
                        "hasSome",
                        "and",
                        "lte",
                        "gte",
                        "or",
                        "not",
                        "ne",
                        "startsWith",
                        "endsWith"
                    ]
                },
                "email": {
                    "displayName": "email",
                    "type": "text",
                    "queryOperators": [
                        "eq",
                        "lt",
                        "gt",
                        "hasSome",
                        "and",
                        "lte",
                        "gte",
                        "or",
                        "not",
                        "ne",
                        "startsWith",
                        "endsWith"
                    ]
                },
   ...
```

## Connect to Your Wix Site

Now that we have a database and an adaptor service, we are ready to add the database as an external collection on our site.

  
 1\. In the Wix editor, select **Databases** from the Velo sidebar.

 2\. Click the ![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/99f9f305-0415-4713-856e-b7aa93cbd4d3/2021/09/29/c0043bd2-1c97-4c1b-80b0-704e57d1e60f/e996cdd7-afcb-481f-be55-4414dd4895b1.png) icon next to **Content Collections** and select **Add External Collections**.

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/99f9f305-0415-4713-856e-b7aa93cbd4d3/2021/09/29/f851ff61-b1d0-4cc1-92d1-f0a8ad5c7207/96217003-621b-40a0-95b8-7f183a54ec22.png) 
  
  
 3\. Enter a name for your external collection.

 4\. Copy and paste your adaptor service's URL into the **Add an endpoint URL** field.

 5\. Enter the Secret Key value that you created in the GCP [**Secret Manager**](https://console.cloud.google.com/security/secret-manager?project=). For this tutorial, we set the SECRET\_KEY value to 'ourLittleSecret'.

 6\. Click **Add**.

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/02/148a2061-e911-428a-9e1d-82d99792463b/da814e69-19da-4ce1-ac9a-6fe1160e92c8.png) 
  
  
 The **Content Management System (CMS)** displays the tables. If your table contains the **\_id**, **\_createdDate**, **\_updatedDate**, and **\_owner** fields, you can add data to the table directly from the **CMS**.

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/99f9f305-0415-4713-856e-b7aa93cbd4d3/2021/09/29/276b519a-c8b0-4ba1-bd39-d1a5218de184/c18d7533-0eb1-48bd-b5b3-9af6196002dc.png)

> **Note:** The **CMS** does not currently support deleting from external collections. You can delete records from your collection using [wix-data.remove()](https://www.wix.com/velo/reference/wix-data/remove) or an [HTTP REST call](https://www.wix.com/velo/reference/spis/external-database-collections/external-database-collections/data/remove-item).

The external connection and its collections are displayed under **Content Collections**.

  
![](https://d2x3xhvgiqkx42.cloudfront.net/12345678-1234-1234-1234-1234567890ab/a551efd3-24d0-48fe-8aec-00f810ffc5fc/2022/05/02/cd477c55-63cd-4192-909a-5be14c74859d/0ef7b139-8bc2-4949-bc75-86596d500617.png) 

  
 You can now use any of the [wix-data](https://www.wix.com/velo/reference/api-overview) and [wix-dataset](https://www.wix.com/velo/reference/wix-dataset) APIs with this collection as well as connect [repeaters](https://support.wix.com/en/article/cms-displaying-dynamic-content-in-a-repeater) and [tables](https://support.wix.com/en/article/cms-formerly-content-manager-displaying-collection-content-in-a-table) to your BigQuery database.

  
 Try the following Velo code to query your external data:

```javascript
import wixData from 'wix-data';

export function externalQuery() {
    return wixData.query("bigQuery_collections/Contacts")
        .find()
        .then((results) => {
            return results;
        })
        .catch((err) => {
            let errorMsg = err;
            return errorMsg;
        });
}
```
