Amazon DynamoDB

2020/11/23 - Amazon DynamoDB - 6 new api methods

Changes  Update dynamodb client to latest version

ExecuteStatement (new) Link ¶

This operation allows you to perform reads and singleton writes on data stored in DynamoDB, using PartiQL.

See also: AWS API Documentation

Request Syntax

client.execute_statement(
    Statement='string',
    Parameters=[
        {
            'S': 'string',
            'N': 'string',
            'B': b'bytes',
            'SS': [
                'string',
            ],
            'NS': [
                'string',
            ],
            'BS': [
                b'bytes',
            ],
            'M': {
                'string': {'... recursive ...'}
            },
            'L': [
                {'... recursive ...'},
            ],
            'NULL': True|False,
            'BOOL': True|False
        },
    ],
    ConsistentRead=True|False,
    NextToken='string'
)
type Statement:

string

param Statement:

[REQUIRED]

The PartiQL statement representing the operation to run.

type Parameters:

list

param Parameters:

The parameters for the PartiQL statement, if any.

  • (dict) --

    Represents the data for an attribute.

    Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.

    For more information, see Data Types in the Amazon DynamoDB Developer Guide.

    • S (string) --

      An attribute of type String. For example:

      "S": "Hello"

    • N (string) --

      An attribute of type Number. For example:

      "N": "123.45"

      Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.

    • B (bytes) --

      An attribute of type Binary. For example:

      "B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"

    • SS (list) --

      An attribute of type String Set. For example:

      "SS": ["Giraffe", "Hippo" ,"Zebra"]

      • (string) --

    • NS (list) --

      An attribute of type Number Set. For example:

      "NS": ["42.2", "-19", "7.5", "3.14"]

      Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.

      • (string) --

    • BS (list) --

      An attribute of type Binary Set. For example:

      "BS": ["U3Vubnk=", "UmFpbnk=", "U25vd3k="]

      • (bytes) --

    • M (dict) --

      An attribute of type Map. For example:

      "M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}

      • (string) --

        • (dict) --

          Represents the data for an attribute.

          Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.

          For more information, see Data Types in the Amazon DynamoDB Developer Guide.

    • L (list) --

      An attribute of type List. For example:

      "L": [ {"S": "Cookies"} , {"S": "Coffee"}, {"N", "3.14159"}]

      • (dict) --

        Represents the data for an attribute.

        Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.

        For more information, see Data Types in the Amazon DynamoDB Developer Guide.

    • NULL (boolean) --

      An attribute of type Null. For example:

      "NULL": true

    • BOOL (boolean) --

      An attribute of type Boolean. For example:

      "BOOL": true

type ConsistentRead:

boolean

param ConsistentRead:

The consistency of a read operation. If set to true, then a strongly consistent read is used; otherwise, an eventually consistent read is used.

type NextToken:

string

param NextToken:

Set this value to get remaining results, if NextToken was returned in the statement response.

rtype:

dict

returns:

Response Syntax

{
    'Items': [
        {
            'string': {
                'S': 'string',
                'N': 'string',
                'B': b'bytes',
                'SS': [
                    'string',
                ],
                'NS': [
                    'string',
                ],
                'BS': [
                    b'bytes',
                ],
                'M': {
                    'string': {'... recursive ...'}
                },
                'L': [
                    {'... recursive ...'},
                ],
                'NULL': True|False,
                'BOOL': True|False
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Items (list) --

      If a read operation was used, this property will contain the result of the reade operation; a map of attribute names and their values. For the write operations this value will be empty.

      • (dict) --

        • (string) --

          • (dict) --

            Represents the data for an attribute.

            Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.

            For more information, see Data Types in the Amazon DynamoDB Developer Guide.

            • S (string) --

              An attribute of type String. For example:

              "S": "Hello"

            • N (string) --

              An attribute of type Number. For example:

              "N": "123.45"

              Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.

            • B (bytes) --

              An attribute of type Binary. For example:

              "B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"

            • SS (list) --

              An attribute of type String Set. For example:

              "SS": ["Giraffe", "Hippo" ,"Zebra"]

              • (string) --

            • NS (list) --

              An attribute of type Number Set. For example:

              "NS": ["42.2", "-19", "7.5", "3.14"]

              Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.

              • (string) --

            • BS (list) --

              An attribute of type Binary Set. For example:

              "BS": ["U3Vubnk=", "UmFpbnk=", "U25vd3k="]

              • (bytes) --

            • M (dict) --

              An attribute of type Map. For example:

              "M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}

              • (string) --

                • (dict) --

                  Represents the data for an attribute.

                  Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.

                  For more information, see Data Types in the Amazon DynamoDB Developer Guide.

            • L (list) --

              An attribute of type List. For example:

              "L": [ {"S": "Cookies"} , {"S": "Coffee"}, {"N", "3.14159"}]

              • (dict) --

                Represents the data for an attribute.

                Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.

                For more information, see Data Types in the Amazon DynamoDB Developer Guide.

            • NULL (boolean) --

              An attribute of type Null. For example:

              "NULL": true

            • BOOL (boolean) --

              An attribute of type Boolean. For example:

              "BOOL": true

    • NextToken (string) --

      If the response of a read request exceeds the response payload limit DynamoDB will set this value in the response. If set, you can use that this value in the subsequent request to get the remaining results.

DisableKinesisStreamingDestination (new) Link ¶

Stops replication from the DynamoDB table to the Kinesis data stream. This is done without deleting either of the resources.

See also: AWS API Documentation

Request Syntax

client.disable_kinesis_streaming_destination(
    TableName='string',
    StreamArn='string'
)
type TableName:

string

param TableName:

[REQUIRED]

The name of the DynamoDB table.

type StreamArn:

string

param StreamArn:

[REQUIRED]

The ARN for a Kinesis data stream.

rtype:

dict

returns:

Response Syntax

{
    'TableName': 'string',
    'StreamArn': 'string',
    'DestinationStatus': 'ENABLING'|'ACTIVE'|'DISABLING'|'DISABLED'|'ENABLE_FAILED'
}

Response Structure

  • (dict) --

    • TableName (string) --

      The name of the table being modified.

    • StreamArn (string) --

      The ARN for the specific Kinesis data stream.

    • DestinationStatus (string) --

      The current status of the replication.

BatchExecuteStatement (new) Link ¶

This operation allows you to perform batch reads and writes on data stored in DynamoDB, using PartiQL.

See also: AWS API Documentation

Request Syntax

client.batch_execute_statement(
    Statements=[
        {
            'Statement': 'string',
            'Parameters': [
                {
                    'S': 'string',
                    'N': 'string',
                    'B': b'bytes',
                    'SS': [
                        'string',
                    ],
                    'NS': [
                        'string',
                    ],
                    'BS': [
                        b'bytes',
                    ],
                    'M': {
                        'string': {'... recursive ...'}
                    },
                    'L': [
                        {'... recursive ...'},
                    ],
                    'NULL': True|False,
                    'BOOL': True|False
                },
            ],
            'ConsistentRead': True|False
        },
    ]
)
type Statements:

list

param Statements:

[REQUIRED]

The list of PartiQL statements representing the batch to run.

  • (dict) --

    A PartiQL batch statement request.

    • Statement (string) -- [REQUIRED]

      A valid PartiQL statement.

    • Parameters (list) --

      The parameters associated with a PartiQL statement in the batch request.

      • (dict) --

        Represents the data for an attribute.

        Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.

        For more information, see Data Types in the Amazon DynamoDB Developer Guide.

        • S (string) --

          An attribute of type String. For example:

          "S": "Hello"

        • N (string) --

          An attribute of type Number. For example:

          "N": "123.45"

          Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.

        • B (bytes) --

          An attribute of type Binary. For example:

          "B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"

        • SS (list) --

          An attribute of type String Set. For example:

          "SS": ["Giraffe", "Hippo" ,"Zebra"]

          • (string) --

        • NS (list) --

          An attribute of type Number Set. For example:

          "NS": ["42.2", "-19", "7.5", "3.14"]

          Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.

          • (string) --

        • BS (list) --

          An attribute of type Binary Set. For example:

          "BS": ["U3Vubnk=", "UmFpbnk=", "U25vd3k="]

          • (bytes) --

        • M (dict) --

          An attribute of type Map. For example:

          "M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}

          • (string) --

            • (dict) --

              Represents the data for an attribute.

              Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.

              For more information, see Data Types in the Amazon DynamoDB Developer Guide.

        • L (list) --

          An attribute of type List. For example:

          "L": [ {"S": "Cookies"} , {"S": "Coffee"}, {"N", "3.14159"}]

          • (dict) --

            Represents the data for an attribute.

            Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.

            For more information, see Data Types in the Amazon DynamoDB Developer Guide.

        • NULL (boolean) --

          An attribute of type Null. For example:

          "NULL": true

        • BOOL (boolean) --

          An attribute of type Boolean. For example:

          "BOOL": true

    • ConsistentRead (boolean) --

      The read consistency of the PartiQL batch request.

rtype:

dict

returns:

Response Syntax

{
    'Responses': [
        {
            'Error': {
                'Code': 'ConditionalCheckFailed'|'ItemCollectionSizeLimitExceeded'|'RequestLimitExceeded'|'ValidationError'|'ProvisionedThroughputExceeded'|'TransactionConflict'|'ThrottlingError'|'InternalServerError'|'ResourceNotFound'|'AccessDenied'|'DuplicateItem',
                'Message': 'string'
            },
            'TableName': 'string',
            'Item': {
                'string': {
                    'S': 'string',
                    'N': 'string',
                    'B': b'bytes',
                    'SS': [
                        'string',
                    ],
                    'NS': [
                        'string',
                    ],
                    'BS': [
                        b'bytes',
                    ],
                    'M': {
                        'string': {'... recursive ...'}
                    },
                    'L': [
                        {'... recursive ...'},
                    ],
                    'NULL': True|False,
                    'BOOL': True|False
                }
            }
        },
    ]
}

Response Structure

  • (dict) --

    • Responses (list) --

      The response to each PartiQL statement in the batch.

      • (dict) --

        A PartiQL batch statement response..

        • Error (dict) --

          The error associated with a failed PartiQL batch statement.

          • Code (string) --

            The error code associated with the failed PartiQL batch statement.

          • Message (string) --

            The error message associated with the PartiQL batch resposne.

        • TableName (string) --

          The table name associated with a failed PartiQL batch statement.

        • Item (dict) --

          A DynamoDB item associated with a BatchStatementResponse

          • (string) --

            • (dict) --

              Represents the data for an attribute.

              Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.

              For more information, see Data Types in the Amazon DynamoDB Developer Guide.

              • S (string) --

                An attribute of type String. For example:

                "S": "Hello"

              • N (string) --

                An attribute of type Number. For example:

                "N": "123.45"

                Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.

              • B (bytes) --

                An attribute of type Binary. For example:

                "B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"

              • SS (list) --

                An attribute of type String Set. For example:

                "SS": ["Giraffe", "Hippo" ,"Zebra"]

                • (string) --

              • NS (list) --

                An attribute of type Number Set. For example:

                "NS": ["42.2", "-19", "7.5", "3.14"]

                Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.

                • (string) --

              • BS (list) --

                An attribute of type Binary Set. For example:

                "BS": ["U3Vubnk=", "UmFpbnk=", "U25vd3k="]

                • (bytes) --

              • M (dict) --

                An attribute of type Map. For example:

                "M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}

                • (string) --

                  • (dict) --

                    Represents the data for an attribute.

                    Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.

                    For more information, see Data Types in the Amazon DynamoDB Developer Guide.

              • L (list) --

                An attribute of type List. For example:

                "L": [ {"S": "Cookies"} , {"S": "Coffee"}, {"N", "3.14159"}]

                • (dict) --

                  Represents the data for an attribute.

                  Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.

                  For more information, see Data Types in the Amazon DynamoDB Developer Guide.

              • NULL (boolean) --

                An attribute of type Null. For example:

                "NULL": true

              • BOOL (boolean) --

                An attribute of type Boolean. For example:

                "BOOL": true

DescribeKinesisStreamingDestination (new) Link ¶

Returns information about the status of Kinesis streaming.

See also: AWS API Documentation

Request Syntax

client.describe_kinesis_streaming_destination(
    TableName='string'
)
type TableName:

string

param TableName:

[REQUIRED]

The name of the table being described.

rtype:

dict

returns:

Response Syntax

{
    'TableName': 'string',
    'KinesisDataStreamDestinations': [
        {
            'StreamArn': 'string',
            'DestinationStatus': 'ENABLING'|'ACTIVE'|'DISABLING'|'DISABLED'|'ENABLE_FAILED',
            'DestinationStatusDescription': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • TableName (string) --

      The name of the table being described.

    • KinesisDataStreamDestinations (list) --

      The list of replica structures for the table being described.

      • (dict) --

        Describes a Kinesis data stream destination.

        • StreamArn (string) --

          The ARN for a specific Kinesis data stream.

        • DestinationStatus (string) --

          The current status of replication.

        • DestinationStatusDescription (string) --

          The human-readable string that corresponds to the replica status.

ExecuteTransaction (new) Link ¶

This operation allows you to perform transactional reads or writes on data stored in DynamoDB, using PartiQL.

See also: AWS API Documentation

Request Syntax

client.execute_transaction(
    TransactStatements=[
        {
            'Statement': 'string',
            'Parameters': [
                {
                    'S': 'string',
                    'N': 'string',
                    'B': b'bytes',
                    'SS': [
                        'string',
                    ],
                    'NS': [
                        'string',
                    ],
                    'BS': [
                        b'bytes',
                    ],
                    'M': {
                        'string': {'... recursive ...'}
                    },
                    'L': [
                        {'... recursive ...'},
                    ],
                    'NULL': True|False,
                    'BOOL': True|False
                },
            ]
        },
    ],
    ClientRequestToken='string'
)
type TransactStatements:

list

param TransactStatements:

[REQUIRED]

The list of PartiQL statements representing the transaction to run.

  • (dict) --

    Represents a PartiQL statment that uses parameters.

    • Statement (string) -- [REQUIRED]

      A PartiQL statment that uses parameters.

    • Parameters (list) --

      The parameter values.

      • (dict) --

        Represents the data for an attribute.

        Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.

        For more information, see Data Types in the Amazon DynamoDB Developer Guide.

        • S (string) --

          An attribute of type String. For example:

          "S": "Hello"

        • N (string) --

          An attribute of type Number. For example:

          "N": "123.45"

          Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.

        • B (bytes) --

          An attribute of type Binary. For example:

          "B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"

        • SS (list) --

          An attribute of type String Set. For example:

          "SS": ["Giraffe", "Hippo" ,"Zebra"]

          • (string) --

        • NS (list) --

          An attribute of type Number Set. For example:

          "NS": ["42.2", "-19", "7.5", "3.14"]

          Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.

          • (string) --

        • BS (list) --

          An attribute of type Binary Set. For example:

          "BS": ["U3Vubnk=", "UmFpbnk=", "U25vd3k="]

          • (bytes) --

        • M (dict) --

          An attribute of type Map. For example:

          "M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}

          • (string) --

            • (dict) --

              Represents the data for an attribute.

              Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.

              For more information, see Data Types in the Amazon DynamoDB Developer Guide.

        • L (list) --

          An attribute of type List. For example:

          "L": [ {"S": "Cookies"} , {"S": "Coffee"}, {"N", "3.14159"}]

          • (dict) --

            Represents the data for an attribute.

            Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.

            For more information, see Data Types in the Amazon DynamoDB Developer Guide.

        • NULL (boolean) --

          An attribute of type Null. For example:

          "NULL": true

        • BOOL (boolean) --

          An attribute of type Boolean. For example:

          "BOOL": true

type ClientRequestToken:

string

param ClientRequestToken:

Set this value to get remaining results, if NextToken was returned in the statement response.

This field is autopopulated if not provided.

rtype:

dict

returns:

Response Syntax

{
    'Responses': [
        {
            'Item': {
                'string': {
                    'S': 'string',
                    'N': 'string',
                    'B': b'bytes',
                    'SS': [
                        'string',
                    ],
                    'NS': [
                        'string',
                    ],
                    'BS': [
                        b'bytes',
                    ],
                    'M': {
                        'string': {'... recursive ...'}
                    },
                    'L': [
                        {'... recursive ...'},
                    ],
                    'NULL': True|False,
                    'BOOL': True|False
                }
            }
        },
    ]
}

Response Structure

  • (dict) --

    • Responses (list) --

      The response to a PartiQL transaction.

      • (dict) --

        Details for the requested item.

        • Item (dict) --

          Map of attribute data consisting of the data type and attribute value.

          • (string) --

            • (dict) --

              Represents the data for an attribute.

              Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.

              For more information, see Data Types in the Amazon DynamoDB Developer Guide.

              • S (string) --

                An attribute of type String. For example:

                "S": "Hello"

              • N (string) --

                An attribute of type Number. For example:

                "N": "123.45"

                Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.

              • B (bytes) --

                An attribute of type Binary. For example:

                "B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"

              • SS (list) --

                An attribute of type String Set. For example:

                "SS": ["Giraffe", "Hippo" ,"Zebra"]

                • (string) --

              • NS (list) --

                An attribute of type Number Set. For example:

                "NS": ["42.2", "-19", "7.5", "3.14"]

                Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.

                • (string) --

              • BS (list) --

                An attribute of type Binary Set. For example:

                "BS": ["U3Vubnk=", "UmFpbnk=", "U25vd3k="]

                • (bytes) --

              • M (dict) --

                An attribute of type Map. For example:

                "M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}

                • (string) --

                  • (dict) --

                    Represents the data for an attribute.

                    Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.

                    For more information, see Data Types in the Amazon DynamoDB Developer Guide.

              • L (list) --

                An attribute of type List. For example:

                "L": [ {"S": "Cookies"} , {"S": "Coffee"}, {"N", "3.14159"}]

                • (dict) --

                  Represents the data for an attribute.

                  Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.

                  For more information, see Data Types in the Amazon DynamoDB Developer Guide.

              • NULL (boolean) --

                An attribute of type Null. For example:

                "NULL": true

              • BOOL (boolean) --

                An attribute of type Boolean. For example:

                "BOOL": true

EnableKinesisStreamingDestination (new) Link ¶

Starts table data replication to the specified Kinesis data stream at a timestamp chosen during the enable workflow. If this operation doesn't return results immediately, use DescribeKinesisStreamingDestination to check if streaming to the Kinesis data stream is ACTIVE.

See also: AWS API Documentation

Request Syntax

client.enable_kinesis_streaming_destination(
    TableName='string',
    StreamArn='string'
)
type TableName:

string

param TableName:

[REQUIRED]

The name of the DynamoDB table.

type StreamArn:

string

param StreamArn:

[REQUIRED]

The ARN for a Kinesis data stream.

rtype:

dict

returns:

Response Syntax

{
    'TableName': 'string',
    'StreamArn': 'string',
    'DestinationStatus': 'ENABLING'|'ACTIVE'|'DISABLING'|'DISABLED'|'ENABLE_FAILED'
}

Response Structure

  • (dict) --

    • TableName (string) --

      The name of the table being modified.

    • StreamArn (string) --

      The ARN for the specific Kinesis data stream.

    • DestinationStatus (string) --

      The current status of the replication.