Sets the automatic maintenance configuration for an Iceberg table, including compaction and snapshot management.
Usage notes
-
The
--typeparameter accepts two maintenance types:icebergCompaction: Merges small data files into larger ones to improve query performance.icebergSnapshotManagement: Deletes expired snapshots to free up storage space.
The
--valueparameter takes a JSON string. Pass the JSON directly or load it from a local file using thefile://prefix.Run this command separately for each maintenance type. To configure both compaction and snapshot management, run the command twice.
Command syntax
ossutil tables-api put-table-maintenance-configuration --table-bucket-arn value --namespace value --name value --type value --value value [flags]
|
Parameter |
Type |
Description |
|
--name |
string |
The table name. Required. |
|
--namespace |
string |
The table's namespace. Required. |
|
--table-bucket-arn |
string |
The ARN of the Table Bucket, in the format |
|
--type |
string |
The maintenance type. Valid values: |
|
--value |
string |
The maintenance configuration in JSON format. Pass the JSON string directly or specify a local file path using the |
The
put-table-maintenance-configurationcommand corresponds to thePutTableMaintenanceConfigurationAPI operation. For details about the API parameters, see PutTableMaintenanceConfiguration.For a list of supported global command-line options, see ossutil global options.
Examples
-
Enable compaction with a target file size of 512 MB.
ossutil tables-api put-table-maintenance-configuration --table-bucket-arn acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket --namespace my_namespace --name my_table --type icebergCompaction --value '{"status":"enabled","settings":{"targetFileSizeMB":512}}' -
Enable snapshot cleanup that retains the 5 most recent snapshots and removes any older than 168 hours (7 days).
ossutil tables-api put-table-maintenance-configuration --table-bucket-arn acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket --namespace my_namespace --name my_table --type icebergSnapshotManagement --value '{"status":"enabled","settings":{"minSnapshotsToKeep":5,"maxSnapshotAgeHours":168}}' -
Load the maintenance configuration from a local JSON file using the
file://prefix.ossutil tables-api put-table-maintenance-configuration --table-bucket-arn acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket --namespace my_namespace --name my_table --type icebergCompaction --value file://compaction-config.json -
Disable compaction for an Iceberg table.
ossutil tables-api put-table-maintenance-configuration --table-bucket-arn acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket --namespace my_namespace --name my_table --type icebergCompaction --value '{"status":"disabled"}'