SnapshotTable
TheSnapshotTable action creates an independent snapshot of an existing table as a new Iceberg table. This creates a separate table that shares the same underlying data files without copying them.
Interface
Overview
The snapshot action creates a new Iceberg table that:- References the same data files as the source table
- Has its own independent metadata and history
- Can be modified without affecting the source table
- Requires no data file copying (metadata-only operation)
- Is useful for creating test environments or table branches
- Creating test or development copies of production tables
- Establishing a baseline for experimentation
- Creating table snapshots for backup purposes
- Branching table state for parallel workflows
Methods
as
Sets the table identifier for the newly created Iceberg table.destTableIdent- The destination table identifier (e.g., “db.new_table”)
this for method chaining
Example:
tableLocation
Sets the table location for the newly created Iceberg table.location- The file system path where the new table metadata should be stored
this for method chaining
Example:
tableProperties
Sets multiple table properties in the newly created Iceberg table.properties- A map of property key-value pairs to include
this for method chaining
Example:
Properties with the same key will be overwritten by later calls.
tableProperty
Sets a single table property in the newly created Iceberg table.key- The property keyvalue- The property value
this for method chaining
Example:
executeWith
Sets an executor service for parallel file reading during the snapshot operation.service- The executor service to use
this for method chaining
Example:
By default, the snapshot operation does not use an executor service. This method is optional and may not be supported by all implementations.
Result
TheResult interface provides statistics about the snapshot operation.
Methods
importedDataFilesCount
Returns the number of data files that were imported (referenced) into the new table. Returns:long - Number of imported data files
Usage Examples
Basic Table Snapshot
Snapshot with Custom Location
Snapshot with Table Properties
Snapshot with Multiple Properties
Parallel Snapshot for Large Tables
Create Multiple Snapshots
Snapshot for Experimentation
Complete Snapshot Workflow
Best Practices
- Use descriptive names: Include timestamps or purpose in snapshot table names
- Set appropriate properties: Configure the snapshot table for its intended use case
- Document snapshots: Use table properties to record the source and creation time
- Clean up snapshots: Remove snapshots when no longer needed to avoid clutter
- Consider location: Place test/dev snapshots in appropriate storage locations
- Verify after creation: Check that the snapshot has the expected schema and data
The snapshot operation is metadata-only and doesn’t copy data files, making it fast and storage-efficient.
Key Characteristics
- No data copying: Data files are referenced, not duplicated
- Independent metadata: Each snapshot has its own metadata and history
- Fast operation: Metadata-only, completes quickly even for large tables
- Storage efficient: Only metadata is duplicated, not data
- Isolated changes: Modifications to the snapshot don’t affect the source
Use Cases
Testing and Development
Experimentation
Backup/Baseline
Related
- MigrateTable - Migrate non-Iceberg tables to Iceberg
- RewriteDataFiles - Optimize data file layout
- ExpireSnapshots - Manage snapshot history