blog
2026/11/22
Read an Iceberg table's change stream with Apache BeamAhmed Abualsaud
You can now continuously read an Iceberg table’s row-level changes (inserts, updates and deletes) using an Apache Beam streaming pipeline. Beam’s native Iceberg change data capture (CDC) source periodically polls a table’s snapshot history and produces row-level changes. It can read a range of commits in batch too. Try it with this quickstart.
Most engines only stream appends out of an Iceberg table. Beam streams updates and deletes too.
Plenty of systems need to follow a table as it changes. A search index has to drop a product when it’s deleted, and a cache has to pick up a price when it’s corrected. A copy of the table has to do both. Appends alone don’t cover this, because many of those changes are updates and deletes: orders get amended, erroneous records get fixed, and customers send GDPR requests to delete their data.
What it looks like
Consider an orders table that gets three new orders, followed by an update that modifies order 1,
deletes order 2, and adds order 4. Read as a live stream of changes, these commits look like this:

Each row is one change to one key. The op column describes what happened, and
_commit_snapshot_sequence_number says which commit it came from. An update shows up as two rows:
the old version and the new one.
Here’s how to read a table’s changes as a stream:
Map<String, Object> config =
Map.of(
"table", "sales.orders",
"catalog_name", "lakehouse",
"catalog_properties", catalogProperties,
"streaming", true,
"poll_interval_seconds", 5,
"include_metadata_columns",
List.of("_change_type", "_commit_snapshot_sequence_number"));
PCollection<Row> changes =
pipeline
.apply(Managed.read(Managed.ICEBERG_CDC).withConfig(config))
.getSinglePCollection();
changes.apply(LogElements.stdout());changes = pipeline | beam.managed.Read(beam.managed.ICEBERG_CDC, config={
"table": "sales.orders",
"catalog_name": "lakehouse",
"catalog_properties": {...},
"streaming": True,
"poll_interval_seconds": 5,
"include_metadata_columns": [
"_change_type", "_commit_snapshot_sequence_number"],
})
changes | beam.Map(print)pipeline:
type: chain
transforms:
- type: ReadFromIcebergCDC
config:
table: sales.orders
catalog_name: lakehouse
catalog_properties: {...}
streaming: true
poll_interval_seconds: 5
include_metadata_columns:
[_change_type, _commit_snapshot_sequence_number]
- type: LogForTesting
options:
streaming: trueTurning on streaming keeps the source polling for new snapshots every poll_interval_seconds, and
their changes come out as they’re committed. The metadata columns are opt-in: list them in
include_metadata_columns, or select them by name in SQL. _change_type carries the same
information as the op column above, spelled out as INSERT, UPDATE_BEFORE, UPDATE_AFTER or
DELETE.
From there, you can send each change wherever it needs to go. To apply the changes to another Iceberg table, use Beam’s CDC sink. You can also choose where to start and stop reading, by snapshot or by time. The quickstart’s options table lists them all.
How the source works
For each snapshot, the source looks at the rows the commit removed and the rows it added, and groups them by primary key:
- A removed row and an added row with the same key become an
UPDATE_BEFOREandUPDATE_AFTERpair. - A key with only a removed row becomes a
DELETE, and a key with only an added row becomes anINSERT. - A copy-on-write commit rewrites whole data files, so it removes and re-adds rows that didn’t change. The source drops those pairs, and you only see the real delta.
You get each commit’s net effect on each key. If one commit changes a key twice, you see the version before the commit and the version after it, and nothing in between.
Iceberg’s own changelog scan doesn’t handle delete files yet, so until it does, Beam uses a scan based on apache/iceberg#14264.
To pair changes up, the source needs the table to have a primary key on NOT NULL columns, which
Iceberg calls identifier fields. The quickstart’s
production notes show how
to add one.
Try it
You can use the CDC source starting with the Beam SDK 2.79.0 version, in Java, Python, YAML and Beam SQL. It works with tables in format v2 or v3.
Start with the Iceberg CDC quickstart. To see the source and sink working together, read Stream changes between Iceberg tables with Apache Beam.
We’d love to hear how you use this feature. Tell us on the user mailing list or open an issue on GitHub.

