Amazon RDS Data API operations reference
The Amazon RDS Data API provides the following operations to perform SQL statements.
|
Data API operation |
AWS CLI command |
Description |
|---|---|---|
|
Runs a SQL statement on a database. |
||
|
Runs a batch SQL statement over an array of data for bulk update and insert operations. You can run a data manipulation language (DML) statement with an array of parameter sets. A batch SQL statement can provide a significant performance improvement over individual insert and update statements. |
You can use either operation to run individual SQL statements or to run transactions. For transactions, Data API provides the following operations.
|
Data API operation |
AWS CLI command |
Description |
|---|---|---|
|
Starts a SQL transaction. |
||
|
Ends a SQL transaction and commits the changes. |
||
|
Performs a rollback of a transaction. |
The operations for performing SQL statements and supporting transactions have the following common Data API parameters and AWS CLI options. Some operations support other parameters or options.
|
Data API operation parameter |
AWS CLI command option |
Required |
Description |
|---|---|---|---|
|
|
|
Yes |
The Amazon Resource Name (ARN) of the Aurora DB cluster. The cluster must be in the same AWS account as the IAM role or user that invokes the Data API. To access a cluster in a different account, assume a role in that account. |
|
|
|
Yes |
The name or ARN of the secret that enables access to the DB cluster. |
RDS Data API supports the following data types for Aurora MySQL:
TINYINT(1),BOOLEAN,BOOLTINYINTSMALLINT[SIGNED|UNSIGNED]MEDIUMINT[SIGNED|UNSIGNED]INT[SIGNED|UNSIGNED]BIGINT[SIGNED|UNSIGNED]FLOATDOUBLEVARCHAR,CHAR,TEXT,ENUMVARBINARY,BINARY,BLOBDATE,TIME,DATETIME,TIMESTAMPDECIMALJSONBIT,BIT(N)
RDS Data API supports following Aurora PostgreSQL scalar types:
BOOLBYTEADATECIDRDECIMAL,NUMERICENUMFLOAT8,DOUBLE PRECISIONINETINT,INT4,SERIALINT2,SMALLINT,SMALLSERIALINT8,BIGINT,BIGSERIALJSONB,JSONREAL,FLOATTEXT,CHAR(N),VARCHAR,NAMETIMETIMESTAMPUUIDVECTOR
RDS Data API supports the following Aurora PostgreSQL array types:
BOOL[],BIT[]DATE[]DECIMAL[],NUMERIC[]FLOAT8[],DOUBLE PRECISION[]INT[],INT4[]INT2[]INT8[],BIGINT[]JSON[]REAL[],FLOAT[]TEXT[],CHAR(N)[],VARCHAR[],NAME[]TIME[]TIMESTAMP[]UUID[]
You can use parameters in Data API calls to ExecuteStatement and
BatchExecuteStatement, and when you run the AWS CLI commands
execute-statement and batch-execute-statement. To use a
parameter, you specify a name-value pair in the SqlParameter data type. You
specify the value with the Field data type. The following table maps Java
Database Connectivity (JDBC) data types to the data types that you specify in Data API
calls.
|
JDBC data type |
Data API data type |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Other types (including types related to date and time) |
|
Note
You can specify the LONG or STRING data type in your Data API call
for LONG values returned by the database. We recommend that you do so to avoid losing precision for extremely large numbers, which can
happen when you work with JavaScript.
Certain types, such as DECIMAL and TIME, require a hint
so that Data API passes String values to the database as the correct type.
To use a hint, include values for typeHint in the SqlParameter
data type. The possible values for typeHint are the following:
-
DATE– The correspondingStringparameter value is sent as an object ofDATEtype to the database. The accepted format isYYYY-MM-DD. -
DECIMAL– The correspondingStringparameter value is sent as an object ofDECIMALtype to the database. -
JSON– The correspondingStringparameter value is sent as an object ofJSONtype to the database. -
TIME– The correspondingStringparameter value is sent as an object ofTIMEtype to the database. The accepted format isHH:MM:SS[.FFF]. -
TIMESTAMP– The correspondingStringparameter value is sent as an object ofTIMESTAMPtype to the database. The accepted format isYYYY-MM-DD HH:MM:SS[.FFF]. -
UUID– The correspondingStringparameter value is sent as an object ofUUIDtype to the database.Note
Currently, Data API doesn't support arrays of Universal Unique Identifiers (UUIDs).
Note
For Amazon Aurora PostgreSQL, Data API always returns the Aurora PostgreSQL data type
TIMESTAMPTZ in UTC time zone.