RDSDataService

Table of Contents

Client

class RDSDataService.Client

A low-level client representing AWS RDS DataService:

import boto3

client = boto3.client('rds-data')

These are the available methods:

batch_execute_statement(**kwargs)

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.

Warning

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.

See also: AWS API Documentation

Request Syntax

response = client.batch_execute_statement(
    database='string',
    parameterSets=[
        [
            {
                'name': 'string',
                'value': {
                    'blobValue': b'bytes',
                    'booleanValue': True|False,
                    'doubleValue': 123.0,
                    'isNull': True|False,
                    'longValue': 123,
                    'stringValue': 'string'
                }
            },
        ],
    ],
    resourceArn='string',
    schema='string',
    secretArn='string',
    sql='string',
    transactionId='string'
)
Parameters
  • database (string) -- The name of the database.
  • parameterSets (list) --

    The parameter set for the batch operation.

    • (list) --
      • (dict) --

        A parameter used in a SQL statement.

        • name (string) --

          The name of the parameter.

        • value (dict) --

          The value of the parameter.

          • blobValue (bytes) --

            A value of BLOB data type.

          • booleanValue (boolean) --

            A value of Boolean data type.

          • doubleValue (float) --

            A value of double data type.

          • isNull (boolean) --

            A NULL value.

          • longValue (integer) --

            A value of long data type.

          • stringValue (string) --

            A value of string data type.

  • resourceArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.

  • schema (string) -- The name of the database schema.
  • secretArn (string) --

    [REQUIRED]

    The name or ARN of the secret that enables access to the DB cluster.

  • sql (string) --

    [REQUIRED]

    The SQL statement to run.

  • transactionId (string) --

    The identifier of a transaction that was started by using the BeginTransaction 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.

Return type

dict

Returns

Response Syntax

{
    'updateResults': [
        {
            'generatedFields': [
                {
                    'blobValue': b'bytes',
                    'booleanValue': True|False,
                    'doubleValue': 123.0,
                    'isNull': True|False,
                    'longValue': 123,
                    'stringValue': 'string'
                },
            ]
        },
    ]
}

Response Structure

  • (dict) --

    The response elements represent the output of a SQL statement over an array of data.

    • updateResults (list) --

      The execution results of each batch entry.

      • (dict) --

        The response elements represent the results of an update.

        • generatedFields (list) --

          Values for fields generated during the request.

          • (dict) --

            Contains a value.

            • blobValue (bytes) --

              A value of BLOB data type.

            • booleanValue (boolean) --

              A value of Boolean data type.

            • doubleValue (float) --

              A value of double data type.

            • isNull (boolean) --

              A NULL value.

            • longValue (integer) --

              A value of long data type.

            • stringValue (string) --

              A value of string data type.

begin_transaction(**kwargs)

Starts a SQL transaction.

Warning

A transaction can run for a maximum of 24 hours. A transaction is terminated and rolled back automatically after 24 hours.

A transaction times out if no calls use its transaction ID in three minutes. If a transaction times out before it's committed, it's rolled back automatically.

DDL statements inside a transaction cause an implicit commit. We recommend that you run each DDL statement in a separate ExecuteStatement call with continueAfterTimeout enabled.

See also: AWS API Documentation

Request Syntax

response = client.begin_transaction(
    database='string',
    resourceArn='string',
    schema='string',
    secretArn='string'
)
Parameters
  • database (string) -- The name of the database.
  • resourceArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.

  • schema (string) -- The name of the database schema.
  • secretArn (string) --

    [REQUIRED]

    The name or ARN of the secret that enables access to the DB cluster.

Return type

dict

Returns

Response Syntax

{
    'transactionId': 'string'
}

Response Structure

  • (dict) --

    The response elements represent the output of a request to start a SQL transaction.

    • transactionId (string) --

      The transaction ID of the transaction started by the call.

can_paginate(operation_name)

Check if an operation can be paginated.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Returns
True if the operation can be paginated, False otherwise.
commit_transaction(**kwargs)

Ends a SQL transaction started with the BeginTransaction operation and commits the changes.

See also: AWS API Documentation

Request Syntax

response = client.commit_transaction(
    resourceArn='string',
    secretArn='string',
    transactionId='string'
)
Parameters
  • resourceArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.

  • secretArn (string) --

    [REQUIRED]

    The name or ARN of the secret that enables access to the DB cluster.

  • transactionId (string) --

    [REQUIRED]

    The identifier of the transaction to end and commit.

Return type

dict

Returns

Response Syntax

{
    'transactionStatus': 'string'
}

Response Structure

  • (dict) --

    The response elements represent the output of a commit transaction request.

    • transactionStatus (string) --

      The status of the commit operation.

execute_sql(**kwargs)

Runs one or more SQL statements.

Warning

This operation is deprecated. Use the BatchExecuteStatement or ExecuteStatement operation.

Danger

This operation is deprecated and may not function as expected. This operation should not be used going forward and is only kept for the purpose of backwards compatiblity.

See also: AWS API Documentation

Request Syntax

response = client.execute_sql(
    awsSecretStoreArn='string',
    database='string',
    dbClusterOrInstanceArn='string',
    schema='string',
    sqlStatements='string'
)
Parameters
  • awsSecretStoreArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the secret that enables access to the DB cluster.

  • database (string) -- The name of the database.
  • dbClusterOrInstanceArn (string) --

    [REQUIRED]

    The ARN of the Aurora Serverless DB cluster.

  • schema (string) -- The name of the database schema.
  • sqlStatements (string) --

    [REQUIRED]

    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.

Return type

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) --

    The response elements represent the output of a request to run one or more SQL statements.

    • sqlStatementResults (list) --

      The results of the SQL statement or statements.

      • (dict) --

        The result of a SQL statement.

        • numberOfRecordsUpdated (integer) --

          The number of records updated by a SQL statement.

        • resultFrame (dict) --

          The result set of the SQL statement.

          • records (list) --

            The records in the result set.

            • (dict) --

              A record returned by a call.

              • values (list) --

                The values returned in the record.

                • (dict) --

                  Contains the value of a column.

                  • arrayValues (list) --

                    An array of column values.

                    • (dict) --

                      Contains the value of a column.

                  • bigIntValue (integer) --

                    A value for a column of big integer data type.

                  • bitValue (boolean) --

                    A value for a column of BIT data type.

                  • blobValue (bytes) --

                    A value for a column of BLOB data type.

                  • doubleValue (float) --

                    A value for a column of double data type.

                  • intValue (integer) --

                    A value for a column of integer data type.

                  • isNull (boolean) --

                    A NULL value.

                  • realValue (float) --

                    A value for a column of real data type.

                  • stringValue (string) --

                    A value for a column of string data type.

                  • structValue (dict) --

                    A value for a column of STRUCT data type.

                    • attributes (list) --

                      The attributes returned in the record.

                      • (dict) --

                        Contains the value of a column.

          • resultSetMetadata (dict) --

            The result-set metadata in the result set.

            • columnCount (integer) --

              The number of columns in the result set.

            • columnMetadata (list) --

              The metadata of the columns in the result set.

              • (dict) --

                Contains the metadata for a column.

                • arrayBaseColumnType (integer) --

                  The type of the column.

                • isAutoIncrement (boolean) --

                  A value that indicates whether the column increments automatically.

                • isCaseSensitive (boolean) --

                  A value that indicates whether the column is case-sensitive.

                • isCurrency (boolean) --

                  A value that indicates whether the column contains currency values.

                • isSigned (boolean) --

                  A value that indicates whether an integer column is signed.

                • label (string) --

                  The label for the column.

                • name (string) --

                  The name of the column.

                • nullable (integer) --

                  A value that indicates whether the column is nullable.

                • precision (integer) --

                  The precision value of a decimal number column.

                • scale (integer) --

                  The scale value of a decimal number column.

                • schemaName (string) --

                  The name of the schema that owns the table that includes the column.

                • tableName (string) --

                  The name of the table that includes the column.

                • type (integer) --

                  The type of the column.

                • typeName (string) --

                  The database-specific data type of the column.

execute_statement(**kwargs)

Runs a SQL statement against a database.

Warning

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.

The response size limit is 1 MB or 1,000 records. If the call returns more than 1 MB of response data or over 1,000 records, the call is terminated.

See also: AWS API Documentation

Request Syntax

response = client.execute_statement(
    continueAfterTimeout=True|False,
    database='string',
    includeResultMetadata=True|False,
    parameters=[
        {
            'name': 'string',
            'value': {
                'blobValue': b'bytes',
                'booleanValue': True|False,
                'doubleValue': 123.0,
                'isNull': True|False,
                'longValue': 123,
                'stringValue': 'string'
            }
        },
    ],
    resourceArn='string',
    schema='string',
    secretArn='string',
    sql='string',
    transactionId='string'
)
Parameters
  • continueAfterTimeout (boolean) --

    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.

    Warning

    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.

  • database (string) -- The name of the database.
  • includeResultMetadata (boolean) -- A value that indicates whether to include metadata in the results.
  • parameters (list) --

    The parameters for the SQL statement.

    • (dict) --

      A parameter used in a SQL statement.

      • name (string) --

        The name of the parameter.

      • value (dict) --

        The value of the parameter.

        • blobValue (bytes) --

          A value of BLOB data type.

        • booleanValue (boolean) --

          A value of Boolean data type.

        • doubleValue (float) --

          A value of double data type.

        • isNull (boolean) --

          A NULL value.

        • longValue (integer) --

          A value of long data type.

        • stringValue (string) --

          A value of string data type.

  • resourceArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.

  • schema (string) -- The name of the database schema.
  • secretArn (string) --

    [REQUIRED]

    The name or ARN of the secret that enables access to the DB cluster.

  • sql (string) --

    [REQUIRED]

    The SQL statement to run.

  • transactionId (string) --

    The identifier of a transaction that was started by using the BeginTransaction 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.

Return type

dict

Returns

Response Syntax

{
    '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'
        },
    ],
    'generatedFields': [
        {
            'blobValue': b'bytes',
            'booleanValue': True|False,
            'doubleValue': 123.0,
            'isNull': True|False,
            'longValue': 123,
            'stringValue': 'string'
        },
    ],
    'numberOfRecordsUpdated': 123,
    'records': [
        [
            {
                'blobValue': b'bytes',
                'booleanValue': True|False,
                'doubleValue': 123.0,
                'isNull': True|False,
                'longValue': 123,
                'stringValue': 'string'
            },
        ],
    ]
}

Response Structure

  • (dict) --

    The response elements represent the output of a request to run a SQL statement against a database.

    • columnMetadata (list) --

      Metadata for the columns included in the results.

      • (dict) --

        Contains the metadata for a column.

        • arrayBaseColumnType (integer) --

          The type of the column.

        • isAutoIncrement (boolean) --

          A value that indicates whether the column increments automatically.

        • isCaseSensitive (boolean) --

          A value that indicates whether the column is case-sensitive.

        • isCurrency (boolean) --

          A value that indicates whether the column contains currency values.

        • isSigned (boolean) --

          A value that indicates whether an integer column is signed.

        • label (string) --

          The label for the column.

        • name (string) --

          The name of the column.

        • nullable (integer) --

          A value that indicates whether the column is nullable.

        • precision (integer) --

          The precision value of a decimal number column.

        • scale (integer) --

          The scale value of a decimal number column.

        • schemaName (string) --

          The name of the schema that owns the table that includes the column.

        • tableName (string) --

          The name of the table that includes the column.

        • type (integer) --

          The type of the column.

        • typeName (string) --

          The database-specific data type of the column.

    • generatedFields (list) --

      Values for fields generated during the request.

      • (dict) --

        Contains a value.

        • blobValue (bytes) --

          A value of BLOB data type.

        • booleanValue (boolean) --

          A value of Boolean data type.

        • doubleValue (float) --

          A value of double data type.

        • isNull (boolean) --

          A NULL value.

        • longValue (integer) --

          A value of long data type.

        • stringValue (string) --

          A value of string data type.

    • numberOfRecordsUpdated (integer) --

      The number of records updated by the request.

    • records (list) --

      The records returned by the SQL statement.

      • (list) --

        • (dict) --

          Contains a value.

          • blobValue (bytes) --

            A value of BLOB data type.

          • booleanValue (boolean) --

            A value of Boolean data type.

          • doubleValue (float) --

            A value of double data type.

          • isNull (boolean) --

            A NULL value.

          • longValue (integer) --

            A value of long data type.

          • stringValue (string) --

            A value of string data type.

generate_presigned_url(ClientMethod, Params=None, ExpiresIn=3600, HttpMethod=None)

Generate a presigned url given a client, its method, and arguments

Parameters
  • ClientMethod (string) -- The client method to presign for
  • Params (dict) -- The parameters normally passed to ClientMethod.
  • ExpiresIn (int) -- The number of seconds the presigned url is valid for. By default it expires in an hour (3600 seconds)
  • HttpMethod (string) -- The http method to use on the generated url. By default, the http method is whatever is used in the method's model.
Returns

The presigned url

get_paginator(operation_name)

Create a paginator for an operation.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Raises OperationNotPageableError
Raised if the operation is not pageable. You can use the client.can_paginate method to check if an operation is pageable.
Return type
L{botocore.paginate.Paginator}
Returns
A paginator object.
get_waiter(waiter_name)

Returns an object that can wait for some condition.

Parameters
waiter_name (str) -- The name of the waiter to get. See the waiters section of the service docs for a list of available waiters.
Returns
The specified waiter object.
Return type
botocore.waiter.Waiter
rollback_transaction(**kwargs)

Performs a rollback of a transaction. Rolling back a transaction cancels its changes.

See also: AWS API Documentation

Request Syntax

response = client.rollback_transaction(
    resourceArn='string',
    secretArn='string',
    transactionId='string'
)
Parameters
  • resourceArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.

  • secretArn (string) --

    [REQUIRED]

    The name or ARN of the secret that enables access to the DB cluster.

  • transactionId (string) --

    [REQUIRED]

    The identifier of the transaction to roll back.

Return type

dict

Returns

Response Syntax

{
    'transactionStatus': 'string'
}

Response Structure

  • (dict) --

    The response elements represent the output of a request to perform a rollback of a transaction.

    • transactionStatus (string) --

      The status of the rollback operation.

Paginators

The available paginators are: