> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sourcemedium.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Deliver to your own BigQuery

> Copy every standard table SourceMedium delivers to you into a BigQuery project you own, with the same dataset and table names.

Workspace **Admins** can open **Warehouse → Destinations** to have SourceMedium copy every standard table it delivers to them into a Google Cloud project they own. The copies keep SourceMedium's dataset and table names, so your queries move over by changing only the project.

Your SourceMedium warehouse stays as it is. Dashboards, AI agents and your existing access keep reading it; your project receives a copy. If the **Destinations** tab is missing, [contact support](https://docs.sourcemedium.com/docs/product-tours/get-support.md) to have it turned on for your workspace.

## What arrives in your project

| Dataset | Contents |
| - | - |
| `sm_transformed_v2` | SourceMedium's reporting tables, such as `obt_orders` |
| `sm_metadata` | The data dictionary and the other metadata tables delivered to you |
| `sm_sources` | The [raw tables you selected](https://docs.sourcemedium.com/docs/data-activation/managed-data-warehouse/raw-data.md) |
| `sm_views` | The report views, which read your project's own copies |

Not copied:

* [Experimental tables](https://docs.sourcemedium.com/docs/data-activation/data-tables/sm_experimental/index.md) (`sm_experimental`) stay in your SourceMedium warehouse.
* Raw tables from connectors that hold financial or payroll records, currently Bill.com, Brex, Gusto, QuickBooks Online, Rippling and Wave, stay in your SourceMedium warehouse.
* SourceMedium's delivery log is not written to your project. Each table's status is on the Destinations page.

## Connect your project

1. Open **Warehouse → Destinations**, enter your **Google Cloud project ID** (lowercase letters, digits and hyphens, not the project name or number), and choose a **Location**.
2. Choose **Set up destination**. SourceMedium creates a delivery account for your workspace.
3. Under **Give SourceMedium access**, give the delivery account **BigQuery User** on the project, as someone who can grant access in it, such as a project Owner. Choose one way:
   * **Open IAM** opens your project in the Google Cloud console. The grant is the step in [Set up in the Google Cloud console](#set-up-in-the-google-cloud-console) below.
   * **Use Cloud Shell** shows a command instead: choose **Copy setup script**, paste it into [Cloud Shell](https://shell.cloud.google.com) and run it. It makes the same grant and is safe to run again.
4. Choose **Test**. The delivery account creates any of the four datasets that is missing, in your chosen location, then checks the managed sources and both locations, creates temporary tables, inspects their security and copies one synthetic row into your project. It deletes the probes after the check. A probe left by an interruption expires. Delivery starts once the Test passes. If a check fails, the page shows the failed checks first. Follow the instructions for each one, then choose **Test again**. A failing Test stops delivery to the project until a Test passes again.

## Permissions

Both setup paths make one grant: **BigQuery User** on your project. It lets the delivery account submit jobs billed to your project and create datasets. Test creates the four datasets, and as their creator the account is their **BigQuery Data Owner**: it can replace their tables, change their access and delete them. BigQuery User also lets the account list your project's other datasets and tables and read their access settings, but not read their data. Reserve the delivered tables and views for SourceMedium. Put your transformations, access policies and custom tables in a separate dataset. Secure the underlying dataset against direct reader access when using authorized views.

To keep the account out of the rest of your project, skip BigQuery User. Create the four datasets yourself in your chosen location, grant the account **BigQuery Data Owner** on each and **BigQuery Job User** on the project, then run **Test**. A project-defined role can replace Data Owner on the datasets if it includes `bigquery.datasets.get`, `bigquery.datasets.getIamPolicy`, `bigquery.tables.create`, `bigquery.tables.delete`, `bigquery.tables.get`, `bigquery.tables.getData`, `bigquery.tables.getIamPolicy`, `bigquery.tables.list`, `bigquery.tables.update`, `bigquery.tables.updateData` and `bigquery.rowAccessPolicies.list`. [BigQuery IAM permissions](https://docs.cloud.google.com/bigquery/docs/access-control)

### Set up in the Google Cloud console

Under **Give SourceMedium access**, the page shows the delivery account with **Copy**, and **Open IAM** opens the IAM page for your project. The delivery account ends in `.iam.gserviceaccount.com`.

![The Google Cloud console step on the Destinations page](https://mintcdn.com/sourcemedium/kfcd-UcmnjtuPCLv/images/article-imgs/deliver-to-your-own-bigquery/destinations-console-steps.png?fit=max\&auto=format\&n=kfcd-UcmnjtuPCLv\&q=85\&s=9d5ac7fef3e16f11233b12f0ef9c970d)

Open [IAM](https://console.cloud.google.com/iam-admin/iam) in your project and choose **Grant access**.

![The IAM page, with Grant access](https://mintcdn.com/sourcemedium/kfcd-UcmnjtuPCLv/images/article-imgs/deliver-to-your-own-bigquery/iam-grant-access.png?fit=max\&auto=format\&n=kfcd-UcmnjtuPCLv\&q=85\&s=178e611ef89b7afb56a3dd7a9b210a7f)

Paste the delivery account into **New principals**.

![The Grant access panel, with the delivery account in New principals](https://mintcdn.com/sourcemedium/kfcd-UcmnjtuPCLv/images/article-imgs/deliver-to-your-own-bigquery/iam-new-principals.png?fit=max\&auto=format\&n=kfcd-UcmnjtuPCLv\&q=85\&s=f3da2f8036f75b753ac48be9c496fca1)

Under **Select a role**, search for **BigQuery User**, choose it, and choose **Save**.

![The role picker, searched for BigQuery User](https://mintcdn.com/sourcemedium/kfcd-UcmnjtuPCLv/images/article-imgs/deliver-to-your-own-bigquery/iam-bigquery-user-role.png?fit=max\&auto=format\&n=kfcd-UcmnjtuPCLv\&q=85\&s=cb84f0fa4acd8ff7f7afd597a77f8e9a)

Return to the Destinations page and choose **Test**.

> [!NOTE]
>
> The delivery account belongs to your workspace alone. SourceMedium stores no key or password for your project: removing the destination deletes the account, which ends its access.

## When tables arrive

After a passing Test, the next scheduled discovery can start your first copies. After that, each table is copied again after it changes in your SourceMedium warehouse. Within one location, a partitioned table can copy just the changed partitions when the other partitions still match. A schema change, removed partitions or an out-of-date destination can require a whole-table copy. A table whose partitioning or clustering changed is created again in your project, because a copy cannot change either. Between locations, each changed table is copied whole.

Changes SourceMedium makes in your SourceMedium warehouse reach your project with the next copy of the affected table. That includes a shopper’s data erasure once the affected table has been copied successfully. A paused or failing destination can retain the earlier data indefinitely. Your warehouse admin governs that copy. Partition updates can become visible separately. A partitioning or clustering change recreates the table. It can be absent or empty until replacement succeeds. Copies you make elsewhere from these tables are yours to manage.

### Costs

The copy jobs run in your project. Google bills your project for storing the tables and, if your location differs from your SourceMedium warehouse's, for each byte copied between locations. Copies within one location have no job charge.

## Check each table

After Test passes, **Tables** appears directly under the destination. It shows each table’s latest copy and when it landed. The destination's status counts the tables that need your attention, and the list shows them first. Up-to-date tables are grouped under a line you can expand. Open **Setup and Test** under **Delivery settings** to review the grants, run **Test again** or choose **Change project**.

| Status | What to do |
| - | - |
| **Up to date** | Nothing. The newest copy landed |
| **Approved** | SourceMedium has your approval for the displayed change. The next successful copy applies it |
| **Copy stopped** | The last copy failed, and the row shows the error. SourceMedium copies the table again after it next changes. Contact SourceMedium if it stays stopped |
| **Check table ownership** | A table or view already uses this delivery name. Preserve your data and contact SourceMedium to move it to another dataset before resuming |
| **Retrying** | Nothing. SourceMedium retries it; the row shows the error |
| **Check your setup** | Your project refused the copy. Check that the delivery account still has **BigQuery User** on the project (or, on the narrower setup, its dataset and Job User grants). Open **Delivery settings → Setup and Test**, restore the grant and choose **Test again** |
| **Needs your approval** | A change would remove columns, change their type or mode, add a required column or change the table's partitioning or clustering. Read the change, then choose **Approve change** |
| **Blocked by table security** | SourceMedium stopped copying the table because a copy could remove row access policies, table IAM grants, policy tags, resource tags or customer-managed encryption keys. Keep the protection in place. Contact SourceMedium to plan a safe move to separate tables or authorized views |

If tables stay in **Check your setup**, **Check table ownership**, **Blocked by table security** or **Needs your approval** for more than two hours, workspace admins and editors get an email naming them, and a recovery notice after delivery confirms the affected tables have recovered.

### Approve a breaking change

SourceMedium holds a copy that would remove a column, change its type or mode (for example, from `NULLABLE` to `REQUIRED`), add a required column or change the table's partitioning or clustering in your project, because queries and loads that rely on the table could break. The row names each change, including the old and new partitioning and clustering fields. This includes a column you added to a delivered table yourself: the next copy replaces the table, so that column would go. Choose **Approve change**, read what it will cost the table, such as a removed column's data, and confirm to let that one change through with the next copy. That copy replaces the whole table and is billed like any other copy (see [Costs](#costs)). While the destination is paused or its last Test failed, the page says what to do before you can approve. New nullable columns arrive without approval.

## Change, pause or remove

* **Change project** points the destination at another project or location. Copies already running in the old project finish first: the page shows the move until then, and **Check the move** checks sooner. Keep the delivery account's access to the old project until the page shows the new one. Then give it **BigQuery User** on the new project and choose **Test**. Delivery waits for the passing Test. The delivery account is reused. Finally, remove its BigQuery User grant from the old project (or, on the narrower setup, its Job User grant and its access on the four datasets).
* **Pause** stops new submissions once it takes effect. An already submitted copy may finish. Tables and their existing data stay in your project. **Resume** lets delivery catch up, including any cross-region copy charges.
* **Remove destination** stops new copies. Jobs already running can finish before SourceMedium deletes the delivery account and its access ends, so keep its grants until removal finishes. Your tables stay in your project. After removal, clean up any deleted-account entries in project IAM and in each dataset’s permissions.

SourceMedium reserves each delivery name on its first copy. An existing table or view with that name stops the copy. After delivery starts, keep customizations in separate tables or authorized views. BigQuery allows your administrators to edit a table while a copy is running, so changing security or schema on a delivered table can lose those changes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.