RDSDataService / Client / batch_execute_statement
batch_execute_statement#
- RDSDataService.Client.batch_execute_statement(**kwargs)#
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.
Note
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.
See also: AWS API Documentation
Request Syntax
response = client.batch_execute_statement( resourceArn='string', secretArn='string', sql='string', database='string', schema='string', parameterSets=[ [ { 'name': 'string', 'value': { 'isNull': True|False, 'booleanValue': True|False, 'longValue': 123, 'doubleValue': 123.0, 'stringValue': 'string', 'blobValue': b'bytes', 'arrayValue': { 'booleanValues': [ True|False, ], 'longValues': [ 123, ], 'doubleValues': [ 123.0, ], 'stringValues': [ 'string', ], 'arrayValues': [ {'... recursive ...'}, ] } }, 'typeHint': 'JSON'|'UUID'|'TIMESTAMP'|'DATE'|'TIME'|'DECIMAL' }, ], ], transactionId='string' )
- Parameters:
resourceArn (string) –
[REQUIRED]
The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.
secretArn (string) –
[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 (string) –
[REQUIRED]
The SQL statement to run. Don’t include a semicolon (;) at the end of the SQL statement.
database (string) – The name of the database.
schema (string) –
The name of the database schema.
Note
Currently, the
schema
parameter isn’t supported.parameterSets (list) –
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
ExecuteStatement
operation instead of theBatchExecuteStatement
operation.
Note
Array parameters are not supported.
(list) –
(dict) –
A parameter used in a SQL statement.
name (string) –
The name of the parameter.
value (dict) –
The value of the parameter.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
isNull
,booleanValue
,longValue
,doubleValue
,stringValue
,blobValue
,arrayValue
.isNull (boolean) –
A NULL value.
booleanValue (boolean) –
A value of Boolean data type.
longValue (integer) –
A value of long data type.
doubleValue (float) –
A value of double data type.
stringValue (string) –
A value of string data type.
blobValue (bytes) –
A value of BLOB data type.
arrayValue (dict) –
An array of values.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
booleanValues
,longValues
,doubleValues
,stringValues
,arrayValues
.booleanValues (list) –
An array of Boolean values.
(boolean) –
longValues (list) –
An array of integers.
(integer) –
doubleValues (list) –
An array of floating-point numbers.
(float) –
stringValues (list) –
An array of strings.
(string) –
arrayValues (list) –
An array of arrays.
(dict) –
Contains an array.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
booleanValues
,longValues
,doubleValues
,stringValues
,arrayValues
.
typeHint (string) –
A hint that specifies the correct object type for data type mapping. Possible values are as follows:
DATE
- The correspondingString
parameter value is sent as an object ofDATE
type to the database. The accepted format isYYYY-MM-DD
.DECIMAL
- The correspondingString
parameter value is sent as an object ofDECIMAL
type to the database.JSON
- The correspondingString
parameter value is sent as an object ofJSON
type to the database.TIME
- The correspondingString
parameter value is sent as an object ofTIME
type to the database. The accepted format isHH:MM:SS[.FFF]
.TIMESTAMP
- The correspondingString
parameter value is sent as an object ofTIMESTAMP
type to the database. The accepted format isYYYY-MM-DD HH:MM:SS[.FFF]
.UUID
- The correspondingString
parameter value is sent as an object ofUUID
type to the database.
transactionId (string) –
The identifier of a transaction that was started by using the
BeginTransaction
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.
- Return type:
dict
- Returns:
Response Syntax
{ 'updateResults': [ { 'generatedFields': [ { 'isNull': True|False, 'booleanValue': True|False, 'longValue': 123, 'doubleValue': 123.0, 'stringValue': 'string', 'blobValue': b'bytes', 'arrayValue': { 'booleanValues': [ True|False, ], 'longValues': [ 123, ], 'doubleValues': [ 123.0, ], 'stringValues': [ 'string', ], 'arrayValues': [ {'... recursive ...'}, ] } }, ] }, ] }
Response Structure
(dict) –
The response elements represent the output of a SQL statement over an array of data.
updateResults (list) –
The execution results of each batch entry.
(dict) –
The response elements represent the results of an update.
generatedFields (list) –
Values for fields generated during the request.
(dict) –
Contains a value.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
isNull
,booleanValue
,longValue
,doubleValue
,stringValue
,blobValue
,arrayValue
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
isNull (boolean) –
A NULL value.
booleanValue (boolean) –
A value of Boolean data type.
longValue (integer) –
A value of long data type.
doubleValue (float) –
A value of double data type.
stringValue (string) –
A value of string data type.
blobValue (bytes) –
A value of BLOB data type.
arrayValue (dict) –
An array of values.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
booleanValues
,longValues
,doubleValues
,stringValues
,arrayValues
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
booleanValues (list) –
An array of Boolean values.
(boolean) –
longValues (list) –
An array of integers.
(integer) –
doubleValues (list) –
An array of floating-point numbers.
(float) –
stringValues (list) –
An array of strings.
(string) –
arrayValues (list) –
An array of arrays.
(dict) –
Contains an array.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
booleanValues
,longValues
,doubleValues
,stringValues
,arrayValues
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
Exceptions
RDSDataService.Client.exceptions.SecretsErrorException
RDSDataService.Client.exceptions.HttpEndpointNotEnabledException
RDSDataService.Client.exceptions.DatabaseErrorException
RDSDataService.Client.exceptions.DatabaseResumingException
RDSDataService.Client.exceptions.DatabaseUnavailableException
RDSDataService.Client.exceptions.TransactionNotFoundException
RDSDataService.Client.exceptions.InvalidSecretException
RDSDataService.Client.exceptions.ServiceUnavailableError
RDSDataService.Client.exceptions.ForbiddenException
RDSDataService.Client.exceptions.DatabaseNotFoundException
RDSDataService.Client.exceptions.AccessDeniedException
RDSDataService.Client.exceptions.BadRequestException
RDSDataService.Client.exceptions.StatementTimeoutException
RDSDataService.Client.exceptions.InternalServerErrorException