Skip to content

create_batch_load_task async

create_batch_load_task(
    data_source_configuration: DataSourceConfiguration,
    report_configuration: ReportConfiguration,
    target_database_name: ResourceCreateAPIName,
    target_table_name: ResourceCreateAPIName,
    *,
    config_overrides: Optional[AsyncTimestreamWriteClientConfig] = None,
    client_token: Optional[ClientRequestToken] = None,
    data_model_configuration: Optional[DataModelConfiguration] = None,
    record_version: Optional[RecordVersion] = None,
) -> CreateBatchLoadTaskResponse

Creates a new Timestream batch load task. A batch load task processes data from a CSV source in an S3 location and writes to a Timestream table. A mapping from source to target is defined in a batch load task. Errors and events are written to a report at an S3 location. For the report, if the KMS key is not specified, the report will be encrypted with an S3 managed key when SSE_S3 is the option. Otherwise an error is thrown. For more information, see Amazon Web Services managed keys. Service quotas apply. For details, see code sample.

Parameters:

Raises:

Source code in docs_src/capo_timestream_write/_services/async_timestream_write.py
async def create_batch_load_task(
    self,
    data_source_configuration: "capo_timestream_write.types.data_source_configuration.DataSourceConfiguration",
    report_configuration: "capo_timestream_write.types.report_configuration.ReportConfiguration",
    target_database_name: "capo_timestream_write.types.resource_create_api_name.ResourceCreateAPIName",
    target_table_name: "capo_timestream_write.types.resource_create_api_name.ResourceCreateAPIName",
    *,
    config_overrides: Optional[AsyncTimestreamWriteClientConfig] = None,
    client_token: Optional[
        "capo_timestream_write.types.client_request_token.ClientRequestToken"
    ] = None,
    data_model_configuration: Optional[
        "capo_timestream_write.types.data_model_configuration.DataModelConfiguration"
    ] = None,
    record_version: Optional[
        "capo_timestream_write.types.record_version.RecordVersion"
    ] = None,
) -> "capo_timestream_write.types.create_batch_load_task_response.CreateBatchLoadTaskResponse":
    """<p>Creates a new Timestream batch load task. A batch load task processes data from a CSV source in an S3 location and writes to a Timestream table. A mapping from source to target is defined in a batch load task. Errors and events are written to a report at an S3 location. For the report, if the KMS key is not specified, the report will be encrypted with an S3 managed key when <code>SSE_S3</code> is the option. Otherwise an error is thrown. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk">Amazon Web Services managed keys</a>. <a href="https://docs.aws.amazon.com/timestream/latest/developerguide/ts-limits.html">Service quotas apply</a>. For details, see <a href="https://docs.aws.amazon.com/timestream/latest/developerguide/code-samples.create-batch-load.html">code sample</a>.</p>

    Args:
        client_token: <p></p>
        data_source_configuration: <p>Defines configuration details about the data source for a batch load task.</p>
        target_database_name: <p>Target Timestream database for a batch load task.</p>
        target_table_name: <p>Target Timestream table for a batch load task.</p>
        record_version: <p></p>

    Raises:
        capo_timestream_write.errors.access_denied_exception.AccessDeniedException: <p>You are not authorized to perform this action.</p>
        capo_timestream_write.errors.conflict_exception.ConflictException: <p>Timestream was unable to process this request because it contains resource that already exists.</p>
        capo_timestream_write.errors.internal_server_exception.InternalServerException: <p> Timestream was unable to fully process this request because of an internal server error.</p>
        capo_timestream_write.errors.invalid_endpoint_exception.InvalidEndpointException: <p>The requested endpoint was not valid.</p>
        capo_timestream_write.errors.resource_not_found_exception.ResourceNotFoundException: <p>The operation tried to access a nonexistent resource. The resource might not be specified correctly, or its status might not be ACTIVE.</p>
        capo_timestream_write.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p> The instance quota of resource exceeded for this account.</p>
        capo_timestream_write.errors.throttling_exception.ThrottlingException: <p> Too many requests were made by a user and they exceeded the service quotas. The request was throttled.</p>
        capo_timestream_write.errors.validation_exception.ValidationException: <p> An invalid or malformed request.</p>
        capo_timestream_write.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_timestream_write.types.create_batch_load_task_request.CreateBatchLoadTaskRequest]",
    ) -> AsyncOperationResponse[
        "capo_timestream_write.types.create_batch_load_task_response.CreateBatchLoadTaskResponse"
    ]:
        import capo_timestream_write._operations.timestream_20181101.create_batch_load_task

        (
            output,
            http_response,
        ) = await capo_timestream_write._operations.timestream_20181101.create_batch_load_task.async_create_batch_load_task(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_timestream_write.types.create_batch_load_task_request.CreateBatchLoadTaskRequest",
    ) -> dict[str, Any]:
        import capo_timestream_write.types.create_batch_load_task_request

        return capo_timestream_write.types.create_batch_load_task_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateBatchLoadTask", redact_input=_redact_input),
    )
    input_: capo_timestream_write.types.create_batch_load_task_request.CreateBatchLoadTaskRequest = {
        "data_source_configuration": data_source_configuration,
        "report_configuration": report_configuration,
        "target_database_name": target_database_name,
        "target_table_name": target_table_name,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if data_model_configuration is not None:
        input_["data_model_configuration"] = data_model_configuration
    if record_version is not None:
        input_["record_version"] = record_version

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