damccorm commented on code in PR #41584:
URL: https://github.com/apache/beam/pull/41584#discussion_r4686970966


##########
website/www/site/content/en/blog/iceberg-cdc-source.md:
##########
@@ -0,0 +1,153 @@
+---
+title: "Read an Iceberg table's change stream with Apache Beam"
+date: 2026-11-22 00:00:00 -0800
+categories:
+  - blog
+authors:
+  - ahmedabu98
+---
+<!--
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+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](/documentation/io/built-in/iceberg-cdc/)**.
+
+Most engines only stream appends out of an Iceberg table. **Beam streams 
updates and deletes too.**
+
+<!--more-->
+
+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:
+
+<img class="center-block" src="/images/blog/iceberg-cdc/changes-live-view.gif"
+     alt="A Beam SQL live view of CHANGES(orders). Three inserts stream in 
from the first commit,
+     then the second commit's changes: order 1's old and new versions, a 
delete of order 2, and an
+     insert of order 4.">
+
+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:
+
+{{< highlight sql >}}
+SELECT *, _change_type, _commit_snapshot_sequence_number
+FROM CHANGES(lakehouse.sales.orders)
+WITH ('streaming' = true, 'poll_interval_seconds' = 5);
+{{< /highlight >}}
+{{< highlight java >}}
+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());
+{{< /highlight >}}
+{{< highlight py >}}
+changes = pipeline | beam.managed.Read("iceberg_cdc", config={

Review Comment:
   Fine for this PR, just a side note: looks like `_ICEBERG_CDC` is still 
private in `apache_beam/transforms/managed.py` — we should probaby expose 
`beam.managed.ICEBERG_CDC` before 2.79.0 cuts so Python users don't have to 
pass the raw `"iceberg_cdc"` string next to `beam.managed.ICEBERG`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to