Compatible versions
Key Features
- Automatic table management: tables are created automatically inside your dataset; schema evolution is handled as the source schema changes.
- History + latest state: every change event is preserved in a history table, with an upsert view exposing the current state per primary key.
- CDC replication: primary keys configured in the subscription mapping are used to apply updates and deletes correctly.
- Native date and time types: dates and timestamps land in
DATE,DATETIME,TIMESTAMPandTIMEcolumns, not as text or epoch numbers. - Partitioning on a business date: each subscription can partition its table on one of its own date columns, with a choice of granularity, partition expiration and required partition filter.
Prerequisites
- A GCP project with BigQuery enabled and an existing dataset — Popsink creates tables, not datasets.
- A service account with the following roles on the dataset/project:
- BigQuery Data Editor (
roles/bigquery.dataEditor) — create tables and insert data - BigQuery Job User (
roles/bigquery.jobUser) — run load jobs
- BigQuery Data Editor (
Configuration
How It Works
For each subscription, Popsink creates:- A history table (
{table}_history) containing all CDC events with metadata columns. - An upsert view (
{table}) exposing the latest state per primary key.
Data types
Columns are typed, by order of precedence, from:- an explicit cast in the subscription’s column mapping;
- the Avro schema of the source record (the datamodel’s schema);
- otherwise, the values of the first row written, for columns neither declares (computed, static or wildcard columns).
A cast in the column mapping produces:
string → STRING, int / long → INT64, float / double → FLOAT64, bool → BOOL, date → DATE, datetime → DATETIME, time → TIME, decimal → NUMERIC or BIGNUMERIC by its precision and scale.
Every history table also carries the metadata columns popsink_timestamp, popsink_uuid and popsink_operation, as STRING.
Tables created before November 2026. Before then, the connector created date and time columns as
STRING (ISO text) or INT64 (days or an epoch since 1970). Those columns keep their type and keep receiving the same values: native types apply only to columns the connector creates from now on. BigQuery cannot change a column’s type in place. To move an existing table to native types, drop its {table}_history table and run a backfill. The table is then recreated with native types.Schema evolution
- New source columns are added as
NULLABLEcolumns. A column whose values are allnullso far is added when its first typed value arrives. - Columns are never retyped or dropped: BigQuery cannot narrow a column’s type. When a source type no longer matches the column, the connector logs the mismatch and converts the value when it can; otherwise the batch is refused. To take a new type, recreate the column or the table.
Partitioning
By default, every{table}_history table is partitioned by ingestion day and clustered on the primary key. A subscription can instead partition its table on a date column of its own, such as an order date, an invoice date or a last-update time. A query that filters on that date then reads only the partitions it needs, even after a backfill has loaded years of history in a single day.
Choosing the column
In the subscription’s mapper, open the column and tick Partition the table on this column. Only one column can be ticked. In the API, set"partition": true on that column of mapper_config (see Transform).
The column must be a date or timestamp: either typed as such by the source schema, or cast to date or datetime in the mapper. Saving the subscription is refused when the ticked column can never be a date: a hashed, encrypted or concatenated column, a cast other than date / datetime, a static value without a date cast, or HOUR granularity on a date cast.
Granularity, expiration and partition filter
These three settings are set through the API, in the subscription’sbigquery object, when you create it (POST /subscriptions/) or update it (PATCH /subscriptions/{id}):
bigquery object is refused on subscriptions whose target is not BigQuery.
Good to know
- A column that is not a date stops the connector. If, when the table is created, the partition column is missing, is not a
DATE/DATETIME/TIMESTAMP, or is aDATEpartitioned byHOUR, the table is not created and the connector stops in error with a message naming the column. No row is written. Fix the partition column in the subscription, then restart the connector. The same happens when the column’s type is declared nowhere (no schema, no cast) and its first value isnull: add a cast todateordatetimein the mapper. - Rows with a
nullpartition date are written to BigQuery’s__NULL__partition. A query that filters on the date leaves them out. - Require a partition filter applies to every query on
{table}_history. A filter that keeps every row,WHERE <column> IS NOT NULL OR <column> IS NULL, is accepted. The upsert view{table}carries that filter itself, so queries on the view are accepted without one, but the view always reads the whole history table. - Backfills from MySQL and SQL Server sources create the table with the same partitioning.
- Tables you created yourself in BigQuery, partitioned by column or by integer range, are written to as they are.