Reading with SQL
Iceberg supports both streaming and batch read in Flink. Execute the following SQL command to switch execution mode:Batch Read
Submit a Flink batch job:Streaming Read
Iceberg supports processing incremental data in Flink streaming jobs which starts from a historical snapshot:See read options for more configuration details.
FLIP-27 Source for SQL
To opt in or out of the FLIP-27 source:Reading Branches and Tags
Branches and tags can be read via SQL by specifying options:Reading with DataStream
Batch Read
This example reads all records from an Iceberg table and prints them to stdout:Streaming Read
This example reads incremental records starting from a specific snapshot:FLIP-27 Source (DataStream)
The FLIP-27 source interface was introduced in Flink 1.12. It aims to solve several shortcomings of the oldSourceFunction interface.
Batch Read with FLIP-27
Streaming Read with FLIP-27
This example starts streaming read from the latest table snapshot (inclusive). Every 60s, it polls the Iceberg table to discover new append-only snapshots:Reading Branches and Tags with DataStream
Branches and tags can also be read via the DataStream API:Inspecting Tables
To inspect a table’s history, snapshots, and other metadata, Iceberg supports metadata tables.Metadata tables are identified by adding the metadata table name after the original table name. For example, history for
db.table is read using db.table$history.History
To show table history:This shows a commit that was rolled back. Snapshot 296410040247533544 and 2999875608062437330 have the same parent snapshot. Snapshot 296410040247533544 was rolled back and is not an ancestor of the current table state.
Snapshots
To show the valid snapshots for a table:Files
To show a table’s current data files:Manifests
To show a table’s current file manifests:Partitions
To show a table’s current partitions:References
To show a table’s known snapshot references:Next Steps
Writes
Write data to Iceberg tables
Configuration
Configure read options for Flink