batch_execute_statement
async
¶
batch_execute_statement(
resource_arn: Arn,
secret_arn: Arn,
sql: SqlStatement,
*,
config_overrides: Optional[AsyncRDSDataClientConfig] = None,
database: Optional[DbName] = None,
schema: Optional[DbName] = None,
parameter_sets: Optional[SqlParameterSets] = None,
transaction_id: Optional[Id] = None,
) -> BatchExecuteStatementResponse
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.
Parameters:
-
resource_arn(Arn) –The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.
-
secret_arn(Arn) –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(SqlStatement) –The SQL statement to run. Don't include a semicolon (;) at the end of the SQL statement.
-
database(Optional[DbName], default:None) –The name of the database.
-
schema(Optional[DbName], default:None) –The name of the database schema.
Currently, the
schemaparameter isn't supported. -
parameter_sets(Optional[SqlParameterSets], default:None) –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
ExecuteStatementoperation instead of theBatchExecuteStatementoperation.
Array parameters are not supported.
-
-
transaction_id(Optional[Id], default:None) –The identifier of a transaction that was started by using the
BeginTransactionoperation. 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.
Raises:
-
AccessDeniedException–You don't have sufficient access to perform this action.
-
BadRequestException–There is an error in the call or in a SQL statement. This exception is deprecated.
-
DatabaseErrorException–There was an error in processing the SQL statement.
-
DatabaseNotFoundException–The DB cluster doesn't have a DB instance.
-
DatabaseResumingException–A request was cancelled because the Aurora Serverless DB instance was paused. The Data API request automatically resumes the DB instance. Wait a few seconds and try again.
-
DatabaseUnavailableException–The writer instance in the DB cluster isn't available.
-
ForbiddenException–There are insufficient privileges to make the call.
-
HttpEndpointNotEnabledException–The HTTP endpoint for using RDS Data API isn't enabled for the DB cluster.
-
InternalServerErrorException–An internal error occurred.
-
InvalidResourceStateException–The resource is in an invalid state.
-
InvalidSecretException–The Secrets Manager secret used with the request isn't valid.
-
SecretsErrorException–There was a problem with the Secrets Manager secret used with the request, caused by one of the following conditions:
-
RDS Data API timed out retrieving the secret.
-
The secret provided wasn't found.
-
The secret couldn't be decrypted.
-
-
ServiceUnavailableError–The service specified by the
resourceArnparameter isn't available. -
StatementTimeoutException–The execution of the SQL statement timed out.
-
TransactionNotFoundException–The transaction ID wasn't found.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_rds_data/_services/async_rds_data.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |