Reading the Change Data Feed from a Delta Table
Reading the CDF data from a table with change data is easy.
Reading CDF Log
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let table = deltalake::open_table("../rust/tests/data/cdf-table").await?;
let ops = DeltaOps(table);
let cdf = ops.load_cdf()
.with_starting_version(0)
.with_ending_version(4)
.build()
.await?;
arrow_cast::pretty::print_batches(&cdf)?;
Ok(())
}
The output can then be used in various execution engines. The python example shows how one might consume the cdf feed inside polars.