Overview
Starting from release 0.5.0, Delta Sharing supports querying Change Data Feed (CDF) from shared tables. This enables you to track row-level changes (inserts, updates, deletes) between table versions.CDF must be enabled by the data provider on the original Delta table. Once enabled and shared through Delta Sharing, recipients can query the change feed just like they would with a regular Delta table.
Basic CDF Queries
To read change data from a Delta Sharing table, use thereadChangeFeed option:
- Scala
- Python
- Java
Version Options
Control which versions to read usingstartingVersion and endingVersion:
Starting Version
Specify the first version to include in the change feed:Ending Version
Specify the last version to include (inclusive):Single version changes
Single version changes
Range of versions
Range of versions
From version to latest
From version to latest
Change Data Schema
The change data feed includes additional metadata columns beyond the table’s regular columns:Understanding Change Types
- Insert
- Update
- Delete
Complete Example
Here’s a comprehensive example analyzing customer data changes:Common Use Cases
Incremental Data Processing
Change Audit Trail
Data Synchronization
Tracking Field-Level Changes
Filtering Change Data
You can apply filters to focus on specific changes:Performance Considerations
Query specific version ranges
Query specific version ranges
Filter by change type early
Filter by change type early
Process incrementally
Process incrementally
Handling Update Pairs
When processing updates, you often need to handle preimage/postimage pairs:Error Handling
Next Steps
Streaming
Stream live changes from shared tables
SQL Usage
Query shared tables with SQL