Amazon S3 Tables¶
Create a Table Bucket¶
To create an Amazon S3 Tables table bucket, use
S3TablesCreateTableBucketOperator.
create_table_bucket = S3TablesCreateTableBucketOperator(
task_id="create_table_bucket",
table_bucket_name=bucket_name,
)
Create a Namespace¶
To create a namespace in an Amazon S3 Tables table bucket, use
S3TablesCreateNamespaceOperator.
setup_namespace = S3TablesCreateNamespaceOperator(
task_id="create_namespace",
table_bucket_arn=create_table_bucket.output,
namespace=namespace,
)
Create a Table¶
To create a new Iceberg table in an Amazon S3 Tables namespace you can use
S3TablesCreateTableOperator.
create_table = S3TablesCreateTableOperator(
task_id="create_table",
table_bucket_arn=create_table_bucket.output,
namespace=namespace,
table_name=table_name,
metadata=SCHEMA,
)
Delete a Namespace¶
To delete a namespace from an Amazon S3 Tables table bucket, use
S3TablesDeleteNamespaceOperator.
delete_namespace = S3TablesDeleteNamespaceOperator(
task_id="delete_namespace",
table_bucket_arn=create_table_bucket.output,
namespace=namespace,
trigger_rule=TriggerRule.ALL_DONE,
)
Delete a Table¶
To delete a table from an Amazon S3 Tables namespace, use
S3TablesDeleteTableOperator.
delete_table = S3TablesDeleteTableOperator(
task_id="delete_table",
table_bucket_arn=create_table_bucket.output,
namespace=namespace,
table_name=renamed_table_name,
trigger_rule=TriggerRule.ALL_DONE,
)
Delete a Table Bucket¶
To delete an Amazon S3 Tables table bucket, use
S3TablesDeleteTableBucketOperator.
delete_table_bucket = S3TablesDeleteTableBucketOperator(
task_id="delete_table_bucket",
table_bucket_arn=create_table_bucket.output,
trigger_rule=TriggerRule.ALL_DONE,
)
Rename a Table¶
To rename a table in an Amazon S3 Tables namespace, use
S3TablesRenameTableOperator.
rename_table = S3TablesRenameTableOperator(
task_id="rename_table",
table_bucket_arn=create_table_bucket.output,
namespace=namespace,
table_name=table_name,
new_name=renamed_table_name,
)
Put a Table Bucket Policy¶
To set a resource policy on an Amazon S3 Tables table bucket, use
S3TablesPutTableBucketPolicyOperator.
put_policy = S3TablesPutTableBucketPolicyOperator(
task_id="put_table_bucket_policy",
table_bucket_arn=create_table_bucket.output,
resource_policy=f'{{"Version":"2012-10-17","Statement":[{{"Sid":"TestPolicy","Effect":"Allow","Principal":{{"AWS":"arn:aws:iam::{account_id}:root"}},"Action":"s3tables:GetTable","Resource":"*"}}]}}',
)
Delete a Table Bucket Policy¶
To delete the resource policy from an Amazon S3 Tables table bucket, use
S3TablesDeleteTableBucketPolicyOperator.
delete_policy = S3TablesDeleteTableBucketPolicyOperator(
task_id="delete_table_bucket_policy",
table_bucket_arn=create_table_bucket.output,
trigger_rule=TriggerRule.ALL_DONE,
)