Skip to content

Batch Execute Statement

rdsdataservice_batch_execute_statement R Documentation

Runs a batch SQL statement over an array of data

Description

Runs a batch SQL statement over an array of data.

You can run bulk update and insert operations for multiple records using a DML statement with different parameter sets. Bulk operations can provide a significant performance improvement over individual insert and update operations.

If a call isn't part of a transaction because it doesn't include the transactionID parameter, changes that result from the call are committed automatically.

There isn't a fixed upper limit on the number of parameter sets. However, the maximum size of the HTTP request submitted through the Data API is 4 MiB. If the request exceeds this limit, the Data API returns an error and doesn't process the request. This 4-MiB limit includes the size of the HTTP headers and the JSON notation in the request. Thus, the number of parameter sets that you can include depends on a combination of factors, such as the size of the SQL statement and the size of each parameter set.

The response size limit is 1 MiB. If the call returns more than 1 MiB of response data, the call is terminated.

Usage

rdsdataservice_batch_execute_statement(resourceArn, secretArn, sql,
  database, schema, parameterSets, transactionId)

Arguments

resourceArn

[required] The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.

secretArn

[required] The ARN of the secret that enables access to the DB cluster. Enter the database user name and password for the credentials in the secret.

For information about creating the secret, see Create a database secret.

sql

[required] The SQL statement to run. Don't include a semicolon (;) at the end of the SQL statement.

database

The name of the database.

schema

The name of the database schema.

Currently, the schema parameter isn't supported.

parameterSets

The parameter set for the batch operation.

The SQL statement is executed as many times as the number of parameter sets provided. To execute a SQL statement with no parameters, use one of the following options:

  • Specify one or more empty parameter sets.

  • Use the execute_statement operation instead of the batch_execute_statement operation.

Array parameters are not supported.

transactionId

The identifier of a transaction that was started by using the begin_transaction operation. Specify the transaction ID of the transaction that you want to include the SQL statement in.

If the SQL statement is not part of a transaction, don't set this parameter.

Value

A list with the following syntax:

list(
  updateResults = list(
    list(
      generatedFields = list(
        list(
          isNull = TRUE|FALSE,
          booleanValue = TRUE|FALSE,
          longValue = 123,
          doubleValue = 123.0,
          stringValue = "string",
          blobValue = raw,
          arrayValue = list(
            booleanValues = list(
              TRUE|FALSE
            ),
            longValues = list(
              123
            ),
            doubleValues = list(
              123.0
            ),
            stringValues = list(
              "string"
            ),
            arrayValues = list(
              list()
            )
          )
        )
      )
    )
  )
)

Request syntax

svc$batch_execute_statement(
  resourceArn = "string",
  secretArn = "string",
  sql = "string",
  database = "string",
  schema = "string",
  parameterSets = list(
    list(
      list(
        name = "string",
        value = list(
          isNull = TRUE|FALSE,
          booleanValue = TRUE|FALSE,
          longValue = 123,
          doubleValue = 123.0,
          stringValue = "string",
          blobValue = raw,
          arrayValue = list(
            booleanValues = list(
              TRUE|FALSE
            ),
            longValues = list(
              123
            ),
            doubleValues = list(
              123.0
            ),
            stringValues = list(
              "string"
            ),
            arrayValues = list(
              list()
            )
          )
        ),
        typeHint = "JSON"|"UUID"|"TIMESTAMP"|"DATE"|"TIME"|"DECIMAL"
      )
    )
  ),
  transactionId = "string"
)