AWS RDS DataService

2018/11/20 - AWS RDS DataService - 1 new api methods

Changes  Update rds-data client to latest version

ExecuteSql (new) Link ΒΆ

Executes any SQL statement on the target database synchronously

See also: AWS API Documentation

Request Syntax

client.execute_sql(
    awsSecretStoreArn='string',
    database='string',
    dbClusterOrInstanceArn='string',
    schema='string',
    sqlStatements='string'
)
type awsSecretStoreArn:

string

param awsSecretStoreArn:

[REQUIRED] ARN of the db credentials in AWS Secret Store or the friendly secret name

type database:

string

param database:

Target DB name

type dbClusterOrInstanceArn:

string

param dbClusterOrInstanceArn:

[REQUIRED] ARN of the target db cluster or instance

type schema:

string

param schema:

Target Schema name

type sqlStatements:

string

param sqlStatements:

[REQUIRED] SQL statement(s) to be executed. Statements can be chained by using semicolons

rtype:

dict

returns:

Response Syntax

{
    'sqlStatementResults': [
        {
            'numberOfRecordsUpdated': 123,
            'resultFrame': {
                'records': [
                    {
                        'values': [
                            {
                                'arrayValues': [
                                    {'... recursive ...'},
                                ],
                                'bigIntValue': 123,
                                'bitValue': True|False,
                                'blobValue': b'bytes',
                                'doubleValue': 123.0,
                                'intValue': 123,
                                'isNull': True|False,
                                'realValue': ...,
                                'stringValue': 'string',
                                'structValue': {
                                    'attributes': [
                                        {'... recursive ...'},
                                    ]
                                }
                            },
                        ]
                    },
                ],
                'resultSetMetadata': {
                    'columnCount': 123,
                    'columnMetadata': [
                        {
                            'arrayBaseColumnType': 123,
                            'isAutoIncrement': True|False,
                            'isCaseSensitive': True|False,
                            'isCurrency': True|False,
                            'isSigned': True|False,
                            'label': 'string',
                            'name': 'string',
                            'nullable': 123,
                            'precision': 123,
                            'scale': 123,
                            'schemaName': 'string',
                            'tableName': 'string',
                            'type': 123,
                            'typeName': 'string'
                        },
                    ]
                }
            }
        },
    ]
}

Response Structure

  • (dict) -- Execute SQL response

    • sqlStatementResults (list) -- Results returned by executing the sql statement(s)

      • (dict) -- SQL statement execution result

        • numberOfRecordsUpdated (integer) -- Number of rows updated.

        • resultFrame (dict) -- ResultFrame returned by executing the sql statement

          • records (list) -- ResultSet Metadata.

            • (dict) -- Row or Record

              • values (list) -- Record

                • (dict) -- Column value

                  • arrayValues (list) -- Arbitrarily nested arrays

                    • (dict) -- Column value

                  • bigIntValue (integer) -- Long value

                  • bitValue (boolean) -- Bit value

                  • blobValue (bytes) -- Blob value

                  • doubleValue (float) -- Double value

                  • intValue (integer) -- Integer value

                  • isNull (boolean) -- Is column null

                  • realValue (float) -- Float value

                  • stringValue (string) -- String value

                  • structValue (dict) -- Struct or UDT

                    • attributes (list) -- Struct or UDT

                      • (dict) -- Column value

          • resultSetMetadata (dict) -- ResultSet Metadata.

            • columnCount (integer) -- Number of columns

            • columnMetadata (list) -- List of columns and their types

              • (dict) -- Column Metadata

                • arrayBaseColumnType (integer) -- Homogenous array base SQL type from java.sql.Types.

                • isAutoIncrement (boolean) -- Whether the designated column is automatically numbered

                • isCaseSensitive (boolean) -- Whether values in the designated column's case matters

                • isCurrency (boolean) -- Whether values in the designated column is a cash value

                • isSigned (boolean) -- Whether values in the designated column are signed numbers

                • label (string) -- Usually specified by the SQL AS. If not specified, return column name.

                • name (string) -- Name of the column.

                • nullable (integer) -- Indicates the nullability of values in the designated column. One of columnNoNulls (0), columnNullable (1), columnNullableUnknown (2)

                • precision (integer) -- Get the designated column's specified column size.For numeric data, this is the maximum precision. For character data, this is the length in characters. For datetime datatypes, this is the length in characters of the String representation (assuming the maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, this is the length in bytes. 0 is returned for data types where the column size is not applicable.

                • scale (integer) -- Designated column's number of digits to right of the decimal point. 0 is returned for data types where the scale is not applicable.

                • schemaName (string) -- Designated column's table's schema

                • tableName (string) -- Designated column's table name

                • type (integer) -- SQL type from java.sql.Types.

                • typeName (string) -- Database-specific type name.