Created on
07-14-2026
11:50 PM
- last edited on
07-14-2026
11:55 PM
by
VidyaSargur
Branching and tagging concepts in Apache Iceberg were introduced in version 1.2.0.
With this feature one can carry out a lot of experiments on data without making copies and discarding them whenever they are not needed. The experiments work in isolation from production workloads without impacting production data. The concepts of tags and branches are very similar to source code version control systems like Git. As in, Git we know we can create multiple development branches on top of the production branch wherein we do our independent code changes, get it reviewed and merge them into the development branch. Later once all development is done we finally merge the branch into the production/release branch. The same concept is applicable in the case of branches created on an Iceberg table.
Similarly, tag in Git refers to a specific commit which helps us to go to any release. The concept helps us to go to any specific version of the table using named references. Branching and tagging in Apache Iceberg refer to creating distinct versions and labels for table snapshots. These features are useful for managing parallel workflows on the same dataset.
This article will help you understand:
Assume we have an Iceberg table called customer_analytics.
Initial State: The production (main) branch contains:
SELECT * FROM customer_analytics;
|
customer_id |
name |
city |
|
101 |
Alice |
New York |
|
102 |
Bob |
Chicago |
|
103 |
Carol |
Seattle |
Current Snapshot:
|
Branch |
Snapshot-ID |
|
main |
S-100 |
ALTER TABLE customer_analytics CREATE BRANCH etl_pipeline;|
Branch |
Snapshot-ID |
|
main |
S-100 |
|
etl_pipeline |
S-100 |
Insert new records
INSERT INTO customer_analytics.branch_etl_pipeline VALUES(104,'David','Boston');
|
Branch |
Snapshot-ID |
|
main |
S-100 |
|
etl_pipeline |
S-101 |
UPDATE customer_analytics.branch_etl_pipeline SET city='New York City' WHERE city='New York';|
Branch |
Snapshot-ID |
|
main |
S-100 |
|
etl_pipeline |
S-101—>S-102 |
DELETE FROM customer_analytics.branch_etl_pipeline WHERE customer_id=102;|
Branch |
Snapshot-ID |
|
main |
S-100 |
|
etl_pipeline |
S-101—>S-102—>S-103 |
ALTER TABLE customer_analytics.branch_etl_pipeline ADD COLUMN region STRING;New snapshot.
|
Branch |
Snapshot-ID |
|
main |
S-100 |
|
etl_pipeline |
S-101—>S-102—>S-103—>S- |
UPDATE customer_analytics.branch_etl_pipeline SET region='East' WHERE city IN ('Boston','New York City');Another snapshot.
|
Branch |
Snapshot-ID |
|
main |
S-100 |
|
etl_pipeline |
S-101—>S-102—>S-103—>S-104—>S-105 |
SELECT * FROM customer_analytics;Result:
|
customer_id |
name |
city |
|
101 |
Alice |
New York |
|
102 |
Bob |
Chicago |
|
103 |
Carol |
Seattle |
SELECT * FROM customer_analytics.branch_etl_pipeline;Result:
|
customer_id |
name |
city |
region |
|
101 |
Alice |
New York City |
East |
|
103 |
Carol |
Seattle |
NULL |
|
104 |
David |
Boston |
East |
CALL catalog_name.system.fast_forward(
table => 'customer_analytics',
branch => 'main',
to => 'etl_pipeline'
);Now
|
Branch |
Snapshot-ID |
|
main |
S-105 |
|
etl_pipeline |
S-105 |
Production now contains the ETL changes.
ALTER TABLE customer_analytics CREATE TAG etl_v1_complete;ALTER TABLE customer_analytics CREATE BRANCH etl_pipeline_v2;
|
Branch |
Snapshot-ID |
|
main |
S-105 |
|
etl_pipeline_v2 |
S-105 |
INSERT INTO customer_analytics.branch_etl_pipeline_v2 VALUES(105,'Emma','Denver','West');
|
Branch |
Snapshot-ID |
|
main |
S-105 |
|
etl_pipeline_v2 |
S-105—>S-106 |
SELECT * FROM customer_analytics VERSION AS OF 'etl_v1_complete';Iceberg returns exactly snapshot S105, regardless of how much the table has evolved since then.This shows Tags capture important milestones, enabling reproducibility, auditing, and easy access to historical versions of the dataset.
Although both branches and tags are table references in Apache Iceberg, they serve different purposes. A branch is designed for ongoing development and independent dataset evolution, whereas a tag acts as a permanent bookmark to a specific snapshot. The following table summarizes their key differences.
|
Feature |
Branch |
Tag |
|
Purpose |
Create an independent line of table evolution |
Mark a specific snapshot in the table’s history |
|
Mutable |
Yes |
No |
|
Accepts New Commits |
Yes |
No |
|
Snapshot Lineage |
Maintains its own evolving snapshot lineage |
Always references a single snapshot |
|
Typical Use Cases |
ETL development, testing, data validation, experimentation |
Data releases, auditing, compliance, rollback points |
|
Supports Data Changes |
INSERTS, UPDATE, DELETE, MERGE |
Read-only |
Throughout the ETL workflow, we created and used both a branch (etl_pipeline) and a tag (etl_v1_complete). Before performing operations on these references, it's useful to know how to discover and inspect the branches and tags associated with an Iceberg table. The next section demonstrates how to list all table references and examine their associated snapshots.
SPARK or HIVE SQL
Check Metadata File Directly:
{"format-version":2,"table-uuid":"e3c9ef15-82f4-4345-b81a-90e2fb93764e",
"Refs":{"test":{"snapshot-id":261722011430761267,"type":"branch"},"main":{"snapshot-id":261722011430761267,"type":"branch"}}}]}Using Iceberg Catalog APIs:
Table table = catalog.loadTable(TableIdentifier.of("source", "t1"));
Map<String, SnapshotRef> refs = table.refs();
for (String refName : refs.keySet()) {
System.out.println("Branch or tag: " + refName);
}To check if an Iceberg table has branches and tags:
These methods allow you to confirm if a table has branches and identify each branch by name and associated snapshot
Branches in Apache Iceberg are mutable references to table snapshots, allowing independent development, testing, backfills, and isolated data changes without impacting the main table lineage.
Tags are immutable references to specific snapshots, mainly used for checkpointing, auditing, backup retention, reproducibility, and point-in-time recovery.
Branches behave similarly to Git branches and can continue evolving with new commits, whereas tags permanently pin a snapshot for historical access.
Both features are available in Iceberg V2+ tables and enable safer data operations, experimentation, governance, and time-travel workflows.
Branches and tags help organizations implement production-grade data engineering workflows with controlled snapshot management and reproducible analytics.