Execute Statement
rdsdataservice_execute_statement | R Documentation |
Runs a SQL statement against a database¶
Description¶
Runs a SQL statement against a database.
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.
If the binary response data from the database is more than 1 MB, the call is terminated.
Usage¶
rdsdataservice_execute_statement(resourceArn, secretArn, sql, database,
schema, parameters, transactionId, includeResultMetadata,
continueAfterTimeout, resultSetOptions, formatRecordsAs)
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.
database
The name of the database.
schema
The name of the database schema.
Currently, the
schema
parameter isn't supported.parameters
The parameters for the SQL statement.
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.
includeResultMetadata
A value that indicates whether to include metadata in the results.
continueAfterTimeout
A value that indicates whether to continue running the statement after the call times out. By default, the statement stops running when the call times out.
For DDL statements, we recommend continuing to run the statement after the call times out. When a DDL statement terminates before it is finished running, it can result in errors and possibly corrupted data structures.
resultSetOptions
Options that control how the result set is returned.
formatRecordsAs
A value that indicates whether to format the result set as a single JSON string. This parameter only applies to
SELECT
statements and is ignored for other types of statements. Allowed values areNONE
andJSON
. The default value isNONE
. The result is returned in theformattedRecords
field.For usage information about the JSON format for result sets, see Using the Data API in the Amazon Aurora User Guide.
Value¶
A list with the following syntax:
list(
records = list(
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()
)
)
)
)
),
columnMetadata = list(
list(
name = "string",
type = 123,
typeName = "string",
label = "string",
schemaName = "string",
tableName = "string",
isAutoIncrement = TRUE|FALSE,
isSigned = TRUE|FALSE,
isCurrency = TRUE|FALSE,
isCaseSensitive = TRUE|FALSE,
nullable = 123,
precision = 123,
scale = 123,
arrayBaseColumnType = 123
)
),
numberOfRecordsUpdated = 123,
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()
)
)
)
),
formattedRecords = "string"
)
Request syntax¶
svc$execute_statement(
resourceArn = "string",
secretArn = "string",
sql = "string",
database = "string",
schema = "string",
parameters = 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",
includeResultMetadata = TRUE|FALSE,
continueAfterTimeout = TRUE|FALSE,
resultSetOptions = list(
decimalReturnType = "STRING"|"DOUBLE_OR_LONG",
longReturnType = "STRING"|"LONG"
),
formatRecordsAs = "NONE"|"JSON"
)