Learning Hub

How to Stream Data into BigQuery: Methods, Costs, Tips

Written by Mimacom | Nov 23, 2026, 4:06:56 PM

There are five main ways to stream data into BigQuery, and the right one depends on where the data starts. Use the Storage Write API when your own code produces the data, a Pub/Sub BigQuery subscription when it already flows through Pub/Sub, Datastream when it lives in an operational database, and Dataflow when it needs transforming on the way in. If Apache Kafka is already your event backbone, a Kafka sink connector writes topics into BigQuery directly. This guide compares the methods, explains what each one costs, and shows how to keep streaming ingestion reliable once it runs in production.

How streaming into BigQuery works

BigQuery has two ways to get data into a table. Batch load jobs copy files from Cloud Storage or another source in one operation, and they are free to run because you only pay for the storage. Streaming ingestion writes rows continuously as they are produced, so data is available for queries within seconds rather than at the next scheduled load.

Streaming makes sense when someone or something acts on the data quickly: an operations dashboard, a fraud model, a recommendation service, or an AI agent that needs the current state of an order. It costs money per byte ingested and adds operational work, so it is worth using only where freshness changes a decision. For everything else, batch loading remains the cheaper option.

Five ways to stream data into BigQuery

Google’s documentation spreads the streaming options across several products. The table below puts them side by side.

MethodData sourceDeliveryTransforms data?Cost modelBest for
Storage Write API (gRPC)Your application codeExactly-once with committed streamsNo, your code doesPer GiB, first 2 TiB per month freeNew streaming integrations you build yourself
Storage Write API (REST)Your application codeBest-effort deduplicationNo, your code doesPer 200 MiB, 1 KB minimum per rowExisting code that uses the legacy streaming inserts
Pub/Sub BigQuery subscriptionMessages in a Pub/Sub topicAt-least-onceNo, writes messages as they arrivePub/Sub pricingEvent data already in Pub/Sub, with no subscriber code
DatastreamMySQL, PostgreSQL, AlloyDB, SQL Server, OracleChange data captureNo, replicates changesPer GB processedReplicating operational databases
DataflowPub/Sub, Kafka, databases, filesDepends on the pipelineYesPer worker resourceData that needs cleaning, joining, or enriching first

Storage Write API (gRPC): The recommended default

The BigQuery Storage Write API combines streaming ingestion and batch loading in a single gRPC interface, and Google recommends it for new projects. It supports exactly-once delivery through committed streams: each write carries an offset, so a retry after a network failure does not create duplicate rows. It also has the lowest price per GiB of any streaming method and supports streaming into Apache Iceberg managed tables. The client libraries for Java, Python, and Go handle most of the protocol work.

Storage Write API (REST), formerly streaming inserts

The REST version is the method many teams still know as streaming inserts, or the tabledata.insertAll call. Google has renamed it the Storage Write API (REST), and it still works. It is simple to call from any language, but it only offers best-effort deduplication through the insertId field, and it costs more per byte. For new work, the gRPC version is the better choice.

Pub/Sub BigQuery subscriptions: No subscriber code

A BigQuery subscription is a Pub/Sub subscription type that writes each message straight into a BigQuery table. Without it, you need a pull or push subscriber, such as a Dataflow job, to read messages and write them. The subscription maps message fields to table columns using the topic schema or the table schema, but it does not transform data. Any cleaning or enrichment happens afterward in BigQuery with SQL.

Datastream: Change data capture from databases

Datastream is Google’s serverless change data capture service. It reads every insert, update, and delete from MySQL, PostgreSQL, AlloyDB, SQL Server, and Oracle databases and replicates them into BigQuery with minimal latency. It also runs the initial backfill, so the BigQuery copy starts complete and stays current. If you want to understand how change data capture fits into a wider integration strategy, read our guide to streaming data integration.

Dataflow: When data needs work on the way in

Dataflow runs Apache Beam pipelines on managed infrastructure and writes to BigQuery through the Storage Write API. It is the right method when events need filtering, joining with reference data, or reshaping before they land, or when a source has no direct connector. Dataflow is the most flexible option and also the one that needs the most engineering, which is why it suits teams already working with Beam. Our article on serverless stream processing covers how it compares with other managed engines.

Streaming from Kafka into BigQuery

Many organizations already run Apache Kafka as the central event platform, with dozens of systems producing to it and consuming from it. In that case, adding Pub/Sub as a second messaging layer only to reach BigQuery adds cost and another system to operate. The more direct route is a Kafka Connect sink that reads from Kafka topics and writes to BigQuery tables.

Confluent’s Google BigQuery Sink V2 connector does this on the Storage Write API, with a choice between streaming mode and batch loading mode per connector. In Confluent Cloud it runs as a fully managed connector, so there are no Connect workers to maintain. The design keeps Kafka as the hub: the same topic that feeds BigQuery can also feed an operational database, a fraud model, and a microservice, each reading at its own pace. If you are deciding how to run Kafka itself, see Confluent Cloud vs. self-hosted Kafka.

Streaming MongoDB into BigQuery

MongoDB comes up often because it stores operational data that analysts want in BigQuery, and its document model does not map neatly onto tables. There are three practical routes. Datastream now supports MongoDB as a source in public preview, with backfill and change data capture, and delivers the data to BigQuery as JSON. Google also provides a Dataflow template, MongoDB (CDC) to BigQuery, which reads change stream records from Pub/Sub and writes them to BigQuery, with an optional user-defined function for transformation.

The third route is Kafka. A MongoDB source connector publishes change events to a Kafka topic, and the BigQuery sink connector writes them to BigQuery. This is the better fit when MongoDB changes should reach other systems as well, or when the organization already runs its integration through Kafka. In all three cases, decide early whether to keep documents as JSON columns or flatten them into typed columns, because that choice shapes every query afterward.

How to stream data into BigQuery without incurring cost

Streaming into BigQuery is never entirely free, but most small and medium workloads can stream at no ingestion cost if they use the right method. The numbers that matter come from Google’s BigQuery pricing page:

  • The Storage Write API (gRPC) costs $0.025 per GiB, and the first 2 TiB per month are free
  • The Storage Write API (REST) costs $0.01 per 200 MiB, with each row billed at a 1 KB minimum
  • Streaming is not available on the BigQuery free tier, so billing must be enabled on the project
  • Batch load jobs have no ingestion charge, which makes them the cheapest choice when a delay of minutes is acceptable
  • Pub/Sub, Datastream, and Dataflow have their own charges in addition to BigQuery’s

In practice, moving from the REST method to the gRPC method is the single biggest saving. The 1 KB minimum on REST means a stream of small events, such as 200-byte sensor readings, is billed at five times its real size. On gRPC, the same stream is billed by actual volume and the first 2 TiB each month cost nothing. After that, the next lever is to stream only the tables that need it and batch-load the rest.

Handling duplicates, schema changes, and quotas

Duplicates are the most common surprise in streaming pipelines. With the REST method, BigQuery uses insertId to remove duplicates on a best-effort basis for about one minute, and Google recommends leaving it out for higher throughput and deduplicating manually instead. The gRPC Storage Write API solves the problem at the source: in committed mode, writes with offsets are applied exactly once.

Schema changes need a plan as well. Adding a nullable column is usually safe, but renaming or changing a field type breaks writers until the table is updated. A schema registry upstream, with compatibility rules enforced before events are published, prevents most of these failures. Quotas are the third constraint. Each method has limits on throughput and concurrent connections per project and region, so check the quota page before load testing, not after a production incident.

Monitoring streaming ingestion

A streaming pipeline that stops writing does not always fail loudly. It can fall behind, reject rows, or hit a quota while the dashboard simply shows older data. Good monitoring tracks write errors and rejected rows in Cloud Monitoring, the delay between an event’s creation time and its arrival in BigQuery, and quota usage against limits. If Kafka feeds BigQuery, consumer lag on the sink connector is the earliest warning sign, because it shows problems before they reach the table. Each streaming table also needs a named owner who is alerted when any of these numbers drift.

FAQs

Did Google BigQuery get rid of streaming inserts?

No. The legacy tabledata.insertAll method still works, but Google has renamed it the Storage Write API (REST). For new projects, Google recommends the gRPC Storage Write API, which costs less and supports exactly-once delivery.

What tools can stream MongoDB into BigQuery?

Datastream supports MongoDB as a source in public preview and delivers data as JSON. Google’s Dataflow template, MongoDB (CDC) to BigQuery, processes change stream records through Pub/Sub. A Kafka pipeline with a MongoDB source connector and a BigQuery sink connector is the third option, and fits best when other systems also need the changes.

Can Pub/Sub write directly to BigQuery without Dataflow?

Yes. A BigQuery subscription writes Pub/Sub messages directly into a BigQuery table, with no subscriber code. Use Dataflow only when messages need transforming or enriching before they land.

Is streaming into BigQuery free?

Not entirely. Streaming requires billing to be enabled, but the gRPC Storage Write API includes the first 2 TiB per month at no charge. Pub/Sub, Datastream, and Dataflow are billed separately.

How fast is streamed data available for queries in BigQuery?

Rows written through the streaming methods are typically available for queries within seconds. End-to-end latency also depends on the upstream system, such as Pub/Sub, Datastream, or a Kafka connector.

How Mimacom can help

Mimacom has built Apache Kafka platforms since 2017 and delivers IBM Confluent as an IBM partner. We connect Confluent with analytics platforms such as BigQuery, Snowflake, and Databricks, so one streaming backbone keeps every consumer current. We design the topics, connectors, and schema rules, choose the right BigQuery ingestion method for each source, and put monitoring in place so lag and errors surface before your users notice. The result is a BigQuery estate your analysts and AI applications can trust to the second.

Pick the method that matches where your data starts

Streaming into BigQuery is straightforward once the source is clear. Application code belongs on the gRPC Storage Write API, Pub/Sub events on a BigQuery subscription, databases on Datastream, and complex transformations on Dataflow. Where Kafka already carries your events, a managed sink connector keeps BigQuery current without adding another messaging layer. If you are designing the wider pipeline, our guide to building streaming data pipelines covers the architecture, and the same principles apply to data streaming in Snowflake.

Talk to our IBM Confluent team about streaming your operational data into BigQuery in real time.

Explore our Confluent services · Contact us