Skip to content

create_table async

create_table(
    table_bucket_arn: TableBucketARN,
    namespace: NamespaceName,
    name: TableName,
    format: OpenTableFormat,
    *,
    config_overrides: Optional[AsyncS3TablesClientConfig] = None,
    metadata: Optional[TableMetadata] = None,
    encryption_configuration: Optional[EncryptionConfiguration] = None,
    storage_class_configuration: Optional[StorageClassConfiguration] = None,
    tags: Optional[Tags] = None,
) -> CreateTableResponse

Creates a new table associated with the given namespace in a table bucket. For more information, see Creating an Amazon S3 table in the Amazon Simple Storage Service User Guide.

Permissions
  • You must have the s3tables:CreateTable permission to use this operation.

  • If you use this operation with the optional metadata request parameter you must have the s3tables:PutTableData permission.

  • If you use this operation with the optional encryptionConfiguration request parameter you must have the s3tables:PutTableEncryption permission.

  • If you use this operation with the storageClassConfiguration request parameter, you must have the s3tables:PutTableStorageClass permission.

  • To create a table with tags, you must have the s3tables:TagResource permission in addition to s3tables:CreateTable permission.

Additionally, If you choose SSE-KMS encryption you must grant the S3 Tables maintenance principal access to your KMS key. For more information, see Permissions requirements for S3 Tables SSE-KMS encryption.

Parameters:

  • table_bucket_arn (TableBucketARN) –

    The Amazon Resource Name (ARN) of the table bucket to create the table in.

  • namespace (NamespaceName) –

    The namespace to associated with the table.

  • name (TableName) –

    The name for the table.

  • format (OpenTableFormat) –

    The format for the table.

  • metadata (Optional[TableMetadata], default: None ) –

    The metadata for the table.

  • encryption_configuration (Optional[EncryptionConfiguration], default: None ) –

    The encryption configuration to use for the table. This configuration specifies the encryption algorithm and, if using SSE-KMS, the KMS key to use for encrypting the table.

    If you choose SSE-KMS encryption you must grant the S3 Tables maintenance principal access to your KMS key. For more information, see Permissions requirements for S3 Tables SSE-KMS encryption.

  • storage_class_configuration (Optional[StorageClassConfiguration], default: None ) –

    The storage class configuration for the table. If not specified, the table inherits the storage class configuration from its table bucket. Specify this parameter to override the bucket's default storage class for this table.

  • tags (Optional[Tags], default: None ) –

    A map of user-defined tags that you would like to apply to the table that you are creating. A tag is a key-value pair that you apply to your resources. Tags can help you organize, track costs for, and control access to resources. For more information, see Tagging for cost allocation or attribute-based access control (ABAC).

    You must have the s3tables:TagResource permission in addition to s3tables:CreateTable permission to create a table with tags.

Raises:

Source code in docs_src/capo_s3tables/_services/async_s3_tables.py
async def create_table(
    self,
    table_bucket_arn: "capo_s3tables.types.table_bucket_arn.TableBucketARN",
    namespace: "capo_s3tables.types.namespace_name.NamespaceName",
    name: "capo_s3tables.types.table_name.TableName",
    format: "capo_s3tables.types.open_table_format.OpenTableFormat",
    *,
    config_overrides: Optional[AsyncS3TablesClientConfig] = None,
    metadata: Optional["capo_s3tables.types.table_metadata.TableMetadata"] = None,
    encryption_configuration: Optional[
        "capo_s3tables.types.encryption_configuration.EncryptionConfiguration"
    ] = None,
    storage_class_configuration: Optional[
        "capo_s3tables.types.storage_class_configuration.StorageClassConfiguration"
    ] = None,
    tags: Optional["capo_s3tables.types.tags.Tags"] = None,
) -> "capo_s3tables.types.create_table_response.CreateTableResponse":
    """<p>Creates a new table associated with the given namespace in a table bucket. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-tables-create.html">Creating an Amazon S3 table</a> in the <i>Amazon Simple Storage Service User Guide</i>.</p> <dl> <dt>Permissions</dt> <dd> <ul> <li> <p>You must have the <code>s3tables:CreateTable</code> permission to use this operation. </p> </li> <li> <p>If you use this operation with the optional <code>metadata</code> request parameter you must have the <code>s3tables:PutTableData</code> permission. </p> </li> <li> <p>If you use this operation with the optional <code>encryptionConfiguration</code> request parameter you must have the <code>s3tables:PutTableEncryption</code> permission. </p> </li> <li> <p>If you use this operation with the <code>storageClassConfiguration</code> request parameter, you must have the <code>s3tables:PutTableStorageClass</code> permission.</p> </li> <li> <p>To create a table with tags, you must have the <code>s3tables:TagResource</code> permission in addition to <code>s3tables:CreateTable</code> permission.</p> </li> </ul> <note> <p>Additionally, If you choose SSE-KMS encryption you must grant the S3 Tables maintenance principal access to your KMS key. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-tables-kms-permissions.html">Permissions requirements for S3 Tables SSE-KMS encryption</a>. </p> </note> </dd> </dl>

    Args:
        table_bucket_arn: <p>The Amazon Resource Name (ARN) of the table bucket to create the table in.</p>
        namespace: <p>The namespace to associated with the table.</p>
        name: <p>The name for the table.</p>
        format: <p>The format for the table.</p>
        metadata: <p>The metadata for the table.</p>
        encryption_configuration: <p>The encryption configuration to use for the table. This configuration specifies the encryption algorithm and, if using SSE-KMS, the KMS key to use for encrypting the table. </p> <note> <p>If you choose SSE-KMS encryption you must grant the S3 Tables maintenance principal access to your KMS key. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-tables-kms-permissions.html">Permissions requirements for S3 Tables SSE-KMS encryption</a>.</p> </note>
        storage_class_configuration: <p>The storage class configuration for the table. If not specified, the table inherits the storage class configuration from its table bucket. Specify this parameter to override the bucket's default storage class for this table.</p>
        tags: <p>A map of user-defined tags that you would like to apply to the table that you are creating. A tag is a key-value pair that you apply to your resources. Tags can help you organize, track costs for, and control access to resources. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/tagging.html">Tagging for cost allocation or attribute-based access control (ABAC)</a>.</p> <note> <p>You must have the <code>s3tables:TagResource</code> permission in addition to <code>s3tables:CreateTable</code> permission to create a table with tags.</p> </note>

    Raises:
        capo_s3tables.errors.bad_request_exception.BadRequestException: <p>The request is invalid or malformed.</p>
        capo_s3tables.errors.conflict_exception.ConflictException: <p>The request failed because there is a conflict with a previous write. You can retry the request.</p>
        capo_s3tables.errors.forbidden_exception.ForbiddenException: <p>The caller isn't authorized to make the request.</p>
        capo_s3tables.errors.internal_server_error_exception.InternalServerErrorException: <p>The request failed due to an internal server error.</p>
        capo_s3tables.errors.not_found_exception.NotFoundException: <p>The request was rejected because the specified resource could not be found.</p>
        capo_s3tables.errors.too_many_requests_exception.TooManyRequestsException: <p>The limit on the number of requests per second was exceeded.</p>
        capo_s3tables.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_s3tables.types.create_table_request.CreateTableRequest]",
    ) -> AsyncOperationResponse[
        "capo_s3tables.types.create_table_response.CreateTableResponse"
    ]:
        import capo_s3tables._operations.s3_table_buckets.create_table

        (
            output,
            http_response,
        ) = await capo_s3tables._operations.s3_table_buckets.create_table.async_create_table(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateTable")
    )
    input_: capo_s3tables.types.create_table_request.CreateTableRequest = {
        "table_bucket_arn": table_bucket_arn,
        "namespace": namespace,
        "name": name,
        "format": format,
    }
    if metadata is not None:
        input_["metadata"] = metadata
    if encryption_configuration is not None:
        input_["encryption_configuration"] = encryption_configuration
    if storage_class_configuration is not None:
        input_["storage_class_configuration"] = storage_class_configuration
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output