Experimental
@aws-cdk/aws-s3tables-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
CompactionProperty Struct
Settings governing the Compaction maintenance action.
Example
ts
// Build a table
const sampleTable = new Table(scope, 'ExampleTable', {
tableName: 'example_table',
namespace: namespace,
openTableFormat: OpenTableFormat.ICEBERG,
withoutMetadata: true,
});
// Build a table with an Iceberg Schema
const sampleTableWithSchema = new Table(scope, 'ExampleSchemaTable', {
tableName: 'example_table_with_schema',
namespace: namespace,
openTableFormat: OpenTableFormat.ICEBERG,
icebergMetadata: {
icebergSchema: {
schemaFieldList: [
{
name: 'id',
type: 'int',
required: true,
},
{
name: 'name',
type: 'string',
},
],
},
},
compaction: {
status: Status.ENABLED,
targetFileSizeMb: 128,
},
snapshotManagement: {
status: Status.ENABLED,
maxSnapshotAgeHours: 48,
minSnapshotsToKeep: 5,
},
});
python
from aws_cdk.aws_s3tables_alpha import IcebergMetadataProperty, IcebergSchemaProperty, SchemaFieldProperty, SchemaFieldProperty, CompactionProperty, SnapshotManagementProperty
# Build a table
sample_table = Table(scope, "ExampleTable",
table_name="example_table",
namespace=namespace,
open_table_format=OpenTableFormat.ICEBERG,
without_metadata=True
)
# Build a table with an Iceberg Schema
sample_table_with_schema = Table(scope, "ExampleSchemaTable",
table_name="example_table_with_schema",
namespace=namespace,
open_table_format=OpenTableFormat.ICEBERG,
iceberg_metadata=IcebergMetadataProperty(
iceberg_schema=IcebergSchemaProperty(
schema_field_list=[SchemaFieldProperty(
name="id",
type="int",
required=True
), SchemaFieldProperty(
name="name",
type="string"
)
]
)
),
compaction=CompactionProperty(
status=Status.ENABLED,
target_file_size_mb=128
),
snapshot_management=SnapshotManagementProperty(
status=Status.ENABLED,
max_snapshot_age_hours=48,
min_snapshots_to_keep=5
)
)
java
// Build a table
Table sampleTable = Table.Builder.create(scope, "ExampleTable")
.tableName("example_table")
.namespace(namespace)
.openTableFormat(OpenTableFormat.ICEBERG)
.withoutMetadata(true)
.build();
// Build a table with an Iceberg Schema
Table sampleTableWithSchema = Table.Builder.create(scope, "ExampleSchemaTable")
.tableName("example_table_with_schema")
.namespace(namespace)
.openTableFormat(OpenTableFormat.ICEBERG)
.icebergMetadata(IcebergMetadataProperty.builder()
.icebergSchema(IcebergSchemaProperty.builder()
.schemaFieldList(List.of(SchemaFieldProperty.builder()
.name("id")
.type("int")
.required(true)
.build(), SchemaFieldProperty.builder()
.name("name")
.type("string")
.build()))
.build())
.build())
.compaction(CompactionProperty.builder()
.status(Status.ENABLED)
.targetFileSizeMb(128)
.build())
.snapshotManagement(SnapshotManagementProperty.builder()
.status(Status.ENABLED)
.maxSnapshotAgeHours(48)
.minSnapshotsToKeep(5)
.build())
.build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.S3Tables.Alpha
// Build a table
var sampleTable = new Table(scope, "ExampleTable", new TableProps {
TableName = "example_table",
Namespace = namespace,
OpenTableFormat = OpenTableFormat.ICEBERG,
WithoutMetadata = true
});
// Build a table with an Iceberg Schema
var sampleTableWithSchema = new Table(scope, "ExampleSchemaTable", new TableProps {
TableName = "example_table_with_schema",
Namespace = namespace,
OpenTableFormat = OpenTableFormat.ICEBERG,
IcebergMetadata = new IcebergMetadataProperty {
IcebergSchema = new IcebergSchemaProperty {
SchemaFieldList = new [] { new SchemaFieldProperty {
Name = "id",
Type = "int",
Required = true
}, new SchemaFieldProperty {
Name = "name",
Type = "string"
} }
}
},
Compaction = new CompactionProperty {
Status = Status.ENABLED,
TargetFileSizeMb = 128
},
SnapshotManagement = new SnapshotManagementProperty {
Status = Status.ENABLED,
MaxSnapshotAgeHours = 48,
MinSnapshotsToKeep = 5
}
});
go
// Build a table
sampleTable := awscdkawss3tablesalpha.NewTable(*scope, jsii.String("ExampleTable"), &TableProps{
TableName: jsii.String("example_table"),
Namespace: namespace,
OpenTableFormat: *awscdkawss3tablesalpha.OpenTableFormat_ICEBERG,
WithoutMetadata: jsii.Boolean(true),
})
// Build a table with an Iceberg Schema
sampleTableWithSchema := awscdkawss3tablesalpha.NewTable(*scope, jsii.String("ExampleSchemaTable"), &TableProps{
TableName: jsii.String("example_table_with_schema"),
Namespace: namespace,
OpenTableFormat: *awscdkawss3tablesalpha.OpenTableFormat_ICEBERG,
IcebergMetadata: &IcebergMetadataProperty{
IcebergSchema: &IcebergSchemaProperty{
SchemaFieldList: []SchemaFieldProperty{
&SchemaFieldProperty{
Name: jsii.String("id"),
Type: jsii.String("int"),
Required: jsii.Boolean(true),
},
&SchemaFieldProperty{
Name: jsii.String("name"),
Type: jsii.String("string"),
},
},
},
},
Compaction: &CompactionProperty{
Status: *awscdkawss3tablesalpha.Status_ENABLED,
TargetFileSizeMb: jsii.Number(128),
},
SnapshotManagement: &SnapshotManagementProperty{
Status: *awscdkawss3tablesalpha.Status_ENABLED,
MaxSnapshotAgeHours: jsii.Number(48),
MinSnapshotsToKeep: jsii.Number(5),
},
})