executeSql method

Future<ExecuteSqlResponse> executeSql({
  1. required String awsSecretStoreArn,
  2. required String dbClusterOrInstanceArn,
  3. required String sqlStatements,
  4. String? database,
  5. String? schema,
})

Runs one or more SQL statements.

May throw AccessDeniedException. May throw BadRequestException. May throw ForbiddenException. May throw InternalServerErrorException. May throw ServiceUnavailableError.

Parameter awsSecretStoreArn : The Amazon Resource Name (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.

Parameter dbClusterOrInstanceArn : The ARN of the Aurora Serverless DB cluster.

Parameter sqlStatements : One or more SQL statements to run on the DB cluster.

You can separate SQL statements from each other with a semicolon (;). Any valid SQL statement is permitted, including data definition, data manipulation, and commit statements.

Parameter database : The name of the database.

Parameter schema : The name of the database schema.

Implementation

Future<ExecuteSqlResponse> executeSql({
  required String awsSecretStoreArn,
  required String dbClusterOrInstanceArn,
  required String sqlStatements,
  String? database,
  String? schema,
}) async {
  final $payload = <String, dynamic>{
    'awsSecretStoreArn': awsSecretStoreArn,
    'dbClusterOrInstanceArn': dbClusterOrInstanceArn,
    'sqlStatements': sqlStatements,
    if (database != null) 'database': database,
    if (schema != null) 'schema': schema,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/ExecuteSql',
    exceptionFnMap: _exceptionFns,
  );
  return ExecuteSqlResponse.fromJson(response);
}