Skip to content

put_rows async

put_rows(
    table_arn: TableARN,
    payload: bytes,
    payload_format: PayloadFormat,
    *,
    config_overrides: Optional[AsyncS3TablesClientConfig] = None,
    channel_id: Optional[ChannelId] = None,
    checksum_algorithm: Optional[ChecksumAlgorithm] = None,
) -> PutRowsResponse

The PutRows operation writes rows to a channel of a table in Amazon S3 Tables, so that you can stream data into the table.

The following limits apply to each request:

  • The maximum payload size is 50 MiB (52,428,800 bytes). If the payload is larger, the request fails with a BadRequestException error.

  • The maximum number of rows in a payload is 500,000. If the payload contains more rows, the request fails with a BadRequestException error.

  • Only the default channel is supported. If you specify any other channelId, the request fails with a BadRequestException error.

You can gzip-compress the request body and set Content-Encoding: gzip. The 50 MiB limit applies to the request body and, if the body is compressed, also to the decompressed body. The data decoded from the payload is also limited to 50 MiB.

To send Avro, set payloadFormat to AVRO. The payload of each request must be a single Apache Avro Object Container File (OCF) with at least one row. To write more files, send a separate request for each one. Each field of the writer schema must match a column of the table. The row limit counts the rows in the file.

Permissions

To use this operation, you must have all of the following permissions on the table. Amazon S3 Tables doesn't have a separate s3tables:PutRows permission.

  • s3tables:GetTableData

  • s3tables:PutTableData

  • s3tables:GetTableMetadataLocation

  • s3tables:UpdateTableMetadataLocation

Parameters:

  • table_arn (TableARN) –

    The Amazon Resource Name (ARN) of the table to write rows to.

  • channel_id (Optional[ChannelId], default: None ) –

    The identifier of the channel to write rows to. If you don't specify a channel, the operation uses default. Only default is supported.

  • payload (bytes) –

    The rows to write, encoded in the format that you specify in payloadFormat. The maximum payload size is 50 MiB (52,428,800 bytes), and the maximum number of rows is 500,000.

  • payload_format (PayloadFormat) –

    Specifies the format of the rows in payload. The following values are valid:

    • JSON – Newline-delimited JSON: each row is one JSON object on its own line.

    • AVRO – Apache Avro data in the Object Container File (OCF) format. Other Avro encodings, such as single-object encoding or Avro data without the container, aren't accepted. Each field of the writer schema must match a column of the table.

  • checksum_algorithm (Optional[ChecksumAlgorithm], default: None ) –

    (Optional) The algorithm to use to calculate the checksum of the payload. Each PutRows request must include a payload checksum. If you use an AWS SDK, the SDK calculates the checksum for you. If the checksum doesn't match the payload, the request fails with a BadRequestException error.

Raises:

Source code in docs_src/capo_s3tables/_services/async_s3_tables.py
async def put_rows(
    self,
    table_arn: "capo_s3tables.types.table_arn.TableARN",
    payload: bytes,
    payload_format: "capo_s3tables.types.payload_format.PayloadFormat",
    *,
    config_overrides: Optional[AsyncS3TablesClientConfig] = None,
    channel_id: Optional["capo_s3tables.types.channel_id.ChannelId"] = None,
    checksum_algorithm: Optional[
        "capo_s3tables.types.checksum_algorithm.ChecksumAlgorithm"
    ] = None,
) -> "capo_s3tables.types.put_rows_response.PutRowsResponse":
    """<p>The <code>PutRows</code> operation writes rows to a channel of a table in Amazon S3 Tables, so that you can stream data into the table.</p> <p>The following limits apply to each request:</p> <ul> <li> <p>The maximum payload size is 50 MiB (52,428,800 bytes). If the payload is larger, the request fails with a <code>BadRequestException</code> error.</p> </li> <li> <p>The maximum number of rows in a payload is 500,000. If the payload contains more rows, the request fails with a <code>BadRequestException</code> error.</p> </li> <li> <p>Only the <code>default</code> channel is supported. If you specify any other <code>channelId</code>, the request fails with a <code>BadRequestException</code> error.</p> </li> </ul> <p>You can gzip-compress the request body and set <code>Content-Encoding: gzip</code>. The 50 MiB limit applies to the request body and, if the body is compressed, also to the decompressed body. The data decoded from the payload is also limited to 50 MiB.</p> <p>To send Avro, set <code>payloadFormat</code> to <code>AVRO</code>. The payload of each request must be a single Apache Avro Object Container File (OCF) with at least one row. To write more files, send a separate request for each one. Each field of the writer schema must match a column of the table. The row limit counts the rows in the file.</p> <dl> <dt>Permissions</dt> <dd> <p>To use this operation, you must have all of the following permissions on the table. Amazon S3 Tables doesn't have a separate <code>s3tables:PutRows</code> permission.</p> <ul> <li> <p> <code>s3tables:GetTableData</code> </p> </li> <li> <p> <code>s3tables:PutTableData</code> </p> </li> <li> <p> <code>s3tables:GetTableMetadataLocation</code> </p> </li> <li> <p> <code>s3tables:UpdateTableMetadataLocation</code> </p> </li> </ul> </dd> </dl>

    Args:
        table_arn: <p>The Amazon Resource Name (ARN) of the table to write rows to.</p>
        channel_id: <p>The identifier of the channel to write rows to. If you don't specify a channel, the operation uses <code>default</code>. Only <code>default</code> is supported.</p>
        payload: <p>The rows to write, encoded in the format that you specify in <code>payloadFormat</code>. The maximum payload size is 50 MiB (52,428,800 bytes), and the maximum number of rows is 500,000.</p>
        payload_format: <p>Specifies the format of the rows in <code>payload</code>. The following values are valid:</p> <ul> <li> <p> <code>JSON</code> – Newline-delimited JSON: each row is one JSON object on its own line.</p> </li> <li> <p> <code>AVRO</code> – Apache Avro data in the Object Container File (OCF) format. Other Avro encodings, such as single-object encoding or Avro data without the container, aren't accepted. Each field of the writer schema must match a column of the table.</p> </li> </ul>
        checksum_algorithm: <p>(Optional) The algorithm to use to calculate the checksum of the payload. Each <code>PutRows</code> request must include a payload checksum. If you use an AWS SDK, the SDK calculates the checksum for you. If the checksum doesn't match the payload, the request fails with a <code>BadRequestException</code> error.</p>

    Raises:
        capo_s3tables.errors.access_denied_exception.AccessDeniedException: <p>The action cannot be performed because you do not have the required permission.</p>
        capo_s3tables.errors.bad_request_exception.BadRequestException: <p>The request is invalid or malformed.</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.service_unavailable_exception.ServiceUnavailableException: <p>The request failed because the service is temporarily unavailable. Retry your request.</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.put_rows_request.PutRowsRequest]",
    ) -> AsyncOperationResponse[
        "capo_s3tables.types.put_rows_response.PutRowsResponse"
    ]:
        import capo_s3tables._operations.s3_table_buckets.put_rows

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutRows")
    )
    input_: capo_s3tables.types.put_rows_request.PutRowsRequest = {
        "table_arn": table_arn,
        "payload": payload,
        "payload_format": payload_format,
    }
    if channel_id is not None:
        input_["channel_id"] = channel_id
    if checksum_algorithm is not None:
        input_["checksum_algorithm"] = checksum_algorithm

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