SQL Server to BigQuery: Build a CDC Pipeline That Lands in Your Own Bucket

A SQL Server to BigQuery job often begins life as a nightly bcp export, a CSV file in a bucket and a bq load. That is enough for a dashboard refreshed once a day. It stops being enough when an order ships at noon, a customer moves city, and the afternoon report still shows the morning's values.
SQL Server already records those changes. With change data capture (CDC) on, the SQL Server Agent copies each insert, update and delete from the transaction log into a change table. What is left to decide is who reads those tables and where the rows land.
The usual options:
- Datastream for SQL Server: Google's managed CDC service, near real time by Google's description. Nothing to run, and the rows land in native BigQuery datasets that only BigQuery reads.
- Debezium, Kafka and a BigQuery sink connector: changes in seconds, but you operate Kafka, Kafka Connect, the Debezium SQL Server connector and the sink.
-
bcpto CSV, thenbq load: hours to daily, and every run is a full reload, so a deleted row lingers until the next one.
This tutorial takes a fourth route. OLake Go, an open source (Apache 2.0) replication tool, drains the change tables on a schedule and commits Apache Iceberg tables into BigLake, Google Cloud's Iceberg representational state transfer (REST) catalog. The Parquet files sit in a Cloud Storage bucket you own, BigQuery queries them by a four-part name, and DuckDB and Spark open the same files.
I ran each step below on 2026-10-30 with SQL Server 2022 Developer in Docker, OLake Go v1.1.0 in OLake UI and a bucket in us-central1. Every count and timing in this post comes from that run.
What the SQL Server to BigQuery pipeline is made of
- Source: a
shopdatabase withdbo.customersanddbo.orders, both with CDC on, starting at 8 customers and 40 orders. - Pipeline: OLake Go in Docker Compose. The first sync records the current log sequence number (LSN) and copies each table; later syncs read the change tables from that LSN.
- Destination: a BigLake catalog named after the bucket.
You need: Docker, SQL Server 2016 SP1 or later on Developer, Standard or Enterprise edition with the Agent running, and a Google Cloud project.
Step 1: Turn on CDC in SQL Server
Bring your own tables, or create the two the run used:
CREATE TABLE dbo.customers ( id INT IDENTITY(1,1) PRIMARY KEY, name NVARCHAR(100), email NVARCHAR(200), city NVARCHAR(100), tier NVARCHAR(20), created_at DATETIME2 DEFAULT SYSUTCDATETIME(), updated_at DATETIME2 DEFAULT SYSUTCDATETIME()); CREATE TABLE dbo.orders ( id INT IDENTITY(1,1) PRIMARY KEY, customer_id INT REFERENCES dbo.customers(id), product NVARCHAR(100), amount DECIMAL(10,2), status NVARCHAR(20), created_at DATETIME2 DEFAULT SYSUTCDATETIME(), updated_at DATETIME2 DEFAULT SYSUTCDATETIME()); Next, switch CDC on for the database and for each table, and create a login for OLake Go. The msdb grant at the bottom is the line people forget, and the source test refuses to pass without it.
USE shop; EXEC sys.sp_cdc_enable_db; EXEC sys.sp_cdc_enable_table @source_schema = N'dbo', @source_name = N'customers', @role_name = NULL; EXEC sys.sp_cdc_enable_table @source_schema = N'dbo', @source_name = N'orders', @role_name = NULL; USE master; CREATE LOGIN olake WITH PASSWORD = '<password>'; USE shop; CREATE USER olake FOR LOGIN olake; GRANT SELECT ON SCHEMA :: dbo TO olake; GRANT SELECT ON SCHEMA :: cdc TO olake; GRANT VIEW DATABASE STATE TO olake; -- OLake Go reads the capture job definition in msdb before each sync USE msdb; CREATE USER olake FOR LOGIN olake; GRANT SELECT ON dbo.cdc_jobs TO olake; Confirm it took:
SELECT name, is_cdc_enabled FROM sys.databases WHERE name = 'shop'; -- 1 SELECT capture_instance FROM cdc.change_tables; -- dbo_customers, dbo_orders EXEC msdb.dbo.sp_help_job @job_name = N'cdc.shop_capture'; -- the Agent job exists Two things to know on a real server:
- The Agent is what fills the change tables. If it is stopped, nothing lands in
cdc.*and SQL Server reports no error.EXEC master.dbo.xp_servicecontrol 'QueryState', 'SQLServerAgent'answersRunning.when it is up. - On Cloud SQL the database step is
EXEC msdb.dbo.gcloudsql_cdc_enable_db 'shop'instead. The table step stays the same.
Step 2: Create the bucket and service account in Google Cloud
Everything here happens in the Google Cloud console, inside the project that will hold the tables.
- Open APIs and services, then Enable APIs and services, and enable the BigLake API.
- In Cloud Storage, create a bucket in the region BigQuery will query from (
us-central1for me). The bucket name turns into the catalog name in SQL, so keep it short. - In IAM and Admin (Identity and Access Management), Service Accounts, create one, for example
olake-biglake. Grant it BigLake Editor on the project and Storage Object User on the bucket. - On the account's Keys tab, pick Add key, Create new key, JSON. The key file downloads only once.
You do not create a catalog. BigLake makes one named after the bucket the first time OLake Go calls it, in end-user credential mode, and that is the mode to keep.
Step 3: Start OLake UI and add SQL Server as a source
curl -sSL https://raw.githubusercontent.com/datazip-inc/olake-ui/master/docker-compose-v1.yml | docker compose -f - up -d Open http://localhost:8000 and sign in as admin with the password password. Under Sources, click Create Source, pick MSSQL and keep the OLake Go version on the latest release.
Leave Enable CDC on. Manage Capture Instance lets OLake Go create a new capture instance on its own after a schema change, but it needs db_owner, so leave it off for a read-only login. My connection: host host.docker.internal (SQL Server ran in another container), port 1433, database shop, user olake, SSL disabled.
Click Set up source. OLake Go tests the login, CDC on the database, a capture instance per table and a readable capture job before it saves anything.
Step 4: Point the Iceberg destination at BigLake
Under Destinations, click Create Destination, pick Apache Iceberg and choose BigLake as the catalog type:
| Field | Value |
|---|---|
| REST Catalog URI | https://biglake.googleapis.com/iceberg/v1/restcatalog |
| BigLake Catalog Path | gs://<bucket>, the bucket root with no folder after it |
| Authentication Type | GCP |
| GCP Service Account JSON | the whole key file from step 2 |
| Catalog Name | olake_iceberg |
| GCP Auth Scopes | https://www.googleapis.com/auth/cloud-platform, the default |
| GCP Project ID | your project ID |
| Enable Arrow Writes | off |
Click Create. OLake Go calls the endpoint, creates the catalog on first contact, then writes and drops a test table in the bucket. A 403 from biglake.googleapis.com points at a missing BigLake Editor grant, and one from storage.googleapis.com points at Storage Object User.
Step 5: Create the job and run the first sync
Under Jobs, click Create Job. I named mine sql_server_to_bigquery, gave it a schedule and picked the new source and destination.
Under Advanced Settings, set Target Query Engines to Google BigQuery, Apache Spark and DuckDB. OLake Go then only offers delete formats all three read, and in my run it resolved Positional Deletes.
Click Next. On the Streams page, tick customers and orders, keep Full Refresh + CDC and Upsert, and leave systranschemas unticked (see the tips).
Click Create Job, then Sync Now from the job's menu. The first run copied 48 records (3.05 KB) in 36 seconds, container start included.
The namespace joins the job name, the source database and the schema, so it came out as sql_server_to_bigquery_shop_dbo. To use another name, edit the Iceberg DB field at the top of the Streams page before the first sync.
Step 6: Query the tables in BigQuery
There is nothing to register: the bucket is the catalog and the namespace is the dataset. Open the SQL editor, set the query location to the bucket's region, and use the four-part name:
SELECT id, name, city, tier FROM `<project-id>.<bucket>.sql_server_to_bigquery_shop_dbo.customers` ORDER BY id; SELECT status, count(*) AS n, round(sum(amount), 2) AS total FROM `<project-id>.<bucket>.sql_server_to_bigquery_shop_dbo.orders` GROUP BY status ORDER BY status; The account running the queries needs the BigQuery Job User role plus read access to the catalog. OLake Go adds its own columns to each table, among them _op_type, which is r on every row straight after the first sync.
Step 7: Change rows in SQL Server and sync again
The run then made 12 changes, 7 inserts and 5 updates:
INSERT INTO dbo.customers (name, email, city, tier) VALUES (N'Maya Patel', 'maya@example.com', N'Pune', 'silver'), (N'Lucas Silva', 'lucas@example.com', N'São Paulo', 'bronze'); INSERT INTO dbo.orders (customer_id, product, amount, status) VALUES (9, 'Laptop', 1299.00, 'placed'), (9, 'Mouse', 25.50, 'placed'), (10, 'Monitor', 349.99, 'placed'), (3, 'Keyboard', 89.00, 'placed'), (7, 'Webcam', 79.90, 'placed'); UPDATE dbo.customers SET tier = 'gold', updated_at = SYSUTCDATETIME() WHERE name = N'Liam Carter'; UPDATE dbo.customers SET city = N'Abu Dhabi', updated_at = SYSUTCDATETIME() WHERE name = N'Zara Ali'; UPDATE dbo.orders SET status = 'delivered', updated_at = SYSUTCDATETIME() WHERE id IN (1, 4, 7); Click Sync Now again. The second sync read 12 records (855 bytes) from the change tables and finished in 33 seconds end to end.
The commit per table was small. customers received one data file with 4 rows (the 2 inserts and the new versions of the 2 updated rows) and one positional delete file that retires the 2 old versions. orders followed the same shape with 8 rows and 3 deletes.
Run the customers query again, with no refresh and no ALTER TABLE. BigQuery returns 10 rows, one per key: Liam Carter is gold, Zara Ali is in Abu Dhabi, and Maya Patel and Lucas Silva are new. _op_type reads r on the 6 untouched rows, c on the 2 inserts and u on the 2 updates.
The orders query agreed with SQL Server to the cent. It returned 16 delivered orders worth 8659.68, 18 placed worth 10522.26 and 11 shipped worth 6397.25.
Read the same tables from DuckDB
DuckDB attaches the same catalog with a Google access token. For the files it needs a hash-based message authentication code (HMAC) key for the same service account, from Cloud Storage, Settings, Interoperability.
INSTALL iceberg; LOAD iceberg; INSTALL httpfs; LOAD httpfs; -- gcloud auth print-access-token, or a token minted for the service account CREATE SECRET biglake_catalog ( TYPE iceberg, TOKEN '<access token>', EXTRA_HTTP_HEADERS MAP {'x-goog-user-project': '<project-id>'} ); CREATE SECRET biglake_files (TYPE gcs, KEY_ID '<hmac access id>', SECRET '<hmac secret>'); ATTACH 'gs://<bucket>' AS biglake ( TYPE iceberg, ENDPOINT 'https://biglake.googleapis.com/iceberg/v1/restcatalog', SECRET biglake_catalog ); SELECT id, name, city, tier FROM biglake.sql_server_to_bigquery_shop_dbo.customers ORDER BY id; DuckDB 1.5.5 gave back the same 10 customers and the same orders totals, and so did Spark 4.0.1 with Iceberg 1.10.0. The access token lasts an hour, so when a query fails with 401, run CREATE OR REPLACE SECRET with a new one.
Tips from the run
- Untick
systranschemas. Enabling CDC adds it to the database with no capture instance, so selecting it stops the first sync withCDC is not enabled for stream dbo.systranschemas. - A sync right after a write can come back empty. The capture job fills the change tables every few seconds, so the next sync picks the rows up.
- A new column needs a new capture instance. Create one, or turn on Manage Capture Instance, and OLake Go adds the column on the next sync.
- Decimals become doubles.
decimal,numericandmoneyland asFLOAT64; round at query time for exact arithmetic. - Watch the metadata file. BigLake rejects a
metadata.jsonabove 1 MB, which a busy CDC table reaches after a few thousand syncs, so expire snapshots on a schedule. - Change rows are kept for three days. A job paused longer needs a fresh snapshot.
SQL Server to BigQuery options side by side
| Method | Freshness | Updates and deletes | Where the data lands | What you run |
|---|---|---|---|---|
| Datastream for SQL Server | near real time, by Google's description | yes | native BigQuery datasets, read only by BigQuery | a connection profile and a stream |
| Debezium, Kafka, BigQuery sink | seconds | yes, through the sink's upsert settings | Kafka topics, then BigQuery tables | Kafka, Kafka Connect, Debezium and a sink |
bcp to CSV, then bq load | hours to daily | no, full reloads | native BigQuery tables | a script, a scheduler and a staging bucket |
| OLake Go into BigLake (this post) | CDC on a schedule, down to one minute | yes, as Iceberg row-level deletes | Iceberg tables in your bucket that BigQuery, Spark, DuckDB, Trino and Flink read | one Docker Compose stack, open source |
When native BigQuery tables are the whole goal, Datastream is the shorter path. The catalog route pays off once Spark, DuckDB or a notebook wants the same rows. Its limit is speed: every query reads Parquet from the bucket, so load the hot slice into a native table when a dashboard needs native speed.
FAQ
Does this work on SQL Server Express?
No. Express and Web editions cannot turn on change data capture, so there are no change tables for OLake Go to read. Those editions can still run Full Refresh, or Full Refresh + Incremental on an updated_at column.
Which region should the bucket live in?
In the region where BigQuery will run the queries, since a query over the catalog runs in the bucket's region. A query left on the default US multi-region fails with a "not found" message for a regional bucket.
Do deletes in SQL Server show up in BigQuery?
Yes. Later syncs replay deletes from the change tables too, written as Iceberg row-level deletes, and _op_type marks such a row d. My run only made inserts and updates, so the results above show c and u.
Does OLake Go use BigQuery compute to write the tables?
No. OLake Go runs wherever Docker runs and writes Parquet files to the bucket with the service account's credentials. BigQuery bills only the queries you run, by bytes scanned on demand or by slot time on an edition.
Where to go from here
- Point the source at your own database. On Cloud SQL for SQL Server only the database-level CDC procedure changes.
- Add a table by running
sys.sp_cdc_enable_tablefor it, then ticking it on the job's Streams page. - The full guide, with the CLI tabs, the Spark connection and the complete data type table, is on olake.io.
If a step behaves differently on your setup, say so in the comments and I'll update the post.






