create_iceberg_optimizer

DatasetsApi.create_iceberg_optimizer(id, role_id, type, optimizer_configuration, content_type=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

Create an Iceberg Glue table optimizer

Creates and configures an AWS Glue Iceberg table optimizer for the dataset. Iceberg-only (IsIcebergTable=true); not supported for IcebergCatalog=s3tables (GE-1010). type query param is required and must be one of compaction | retention | orphan-file-deletion. Request body uses Enabled plus optional Configuration keyed by type (compaction: Strategy/MinInputFiles/DeleteFileThreshold; retention: SnapshotRetentionDays/SnapshotsToRetain/CleanExpiredFiles/RunRateHours; orphan-file-deletion: OrphanFileRetentionDays/RunRateHours). IAM role ARN is applied server-side. Not idempotent: AlreadyExistsException surfaces as a create error (use PUT to update).

Parameters:
  • id (str) – Dataset UUID of the Iceberg Glue table that will own the optimizer. (required)

  • role_id (str) – Amorphic role ID the request is authorized against. Must be a role the user belongs to with access to the target dataset. (required)

  • type (str) – Optimizer type to create. Required. One of compaction, retention, or orphan-file-deletion (maps to Glue orphan_file_deletion). (required)

  • optimizer_configuration (OptimizerConfiguration) – Enabled flag and optional type-specific Configuration for the Glue table optimizer. (required)

  • content_type (str) – Must be application/json.

  • _request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.

  • _request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.

  • _content_type (str, Optional) – force content-type for the request.

  • _headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.

  • _host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.

Return type:

OptimizerCreateUpdateResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: POST /datasets/{id}/optimizers

Parameter examples

Name

In

Example

id

path

"b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f"

type

query

"compaction"

Request

Enabled flag and optional type-specific Configuration for the Glue table optimizer.

Create compaction optimizer

{
  "Enabled": true,
  "Configuration": {
    "Strategy": "binpack",
    "MinInputFiles": 100,
    "DeleteFileThreshold": 1
  }
}

Create retention optimizer

{
  "Enabled": true,
  "Configuration": {
    "SnapshotRetentionDays": 7,
    "SnapshotsToRetain": 5,
    "CleanExpiredFiles": true,
    "RunRateHours": 24
  }
}

Create orphan-file-deletion optimizer

{
  "Enabled": true,
  "Configuration": {
    "OrphanFileRetentionDays": 3,
    "RunRateHours": 24
  }
}

Success (HTTP 200)

Optimizer created. Message is “Successfully created the iceberg table optimizer”.

Request / response example

{
  "Message": "Successfully created the iceberg table optimizer"
}

Errors

Documented error codes: GE-1010, RTE-1001.

HTTP 400

Validation or authorization failure. Body is {“Message”: “<CODE> - <text>”}. Codes: GE-1010 (missing type, not Iceberg, s3tables), AUTH-* (unauthorized). Also wraps create-time Glue errors (already exists, access denied).

Missing type query param

{
  "Message": "GE-1010 - Optimizer type is required"
}

Dataset is not Iceberg

{
  "Message": "GE-1010 - Optimizer APIs are only available for Iceberg tables"
}

Optimizer already exists

{
  "Message": "RTE-1001 - Failed to do POST operation on the iceberg optimizer, error - Error creating optimizer: Optimizer already exists. Use PUT to update."
}

HTTP 500

Backend/generic failure. Body is {“Message”: “<CODE> - <text>”} (e.g. RTE-1001).

Unexpected failure

{
  "Message": "RTE-1001 - Failed to do POST operation on the iceberg optimizer, error - <exception text>"
}