transact_write_items

transact_write_items(**kwargs)
TransactWriteItems is a synchronous write operation that groups up to 100 action requests. These actions can target items in different tables, but not in different Amazon Web Services accounts or Regions, and no two actions can target the same item. For example, you cannot both ConditionCheck and Update the same item. The aggregate size of the items in the transaction cannot exceed 4 MB.

The actions are completed atomically so that either all of them succeed, or all of them fail. They are defined by the following objects:

  • Put — Initiates a PutItem operation to write a new item. This structure specifies the primary key of the item to be written, the name of the table to write it in, an optional condition expression that must be satisfied for the write to succeed, a list of the item's attributes, and a field indicating whether to retrieve the item's attributes if the condition is not met.
  • Update — Initiates an UpdateItem operation to update an existing item. This structure specifies the primary key of the item to be updated, the name of the table where it resides, an optional condition expression that must be satisfied for the update to succeed, an expression that defines one or more attributes to be updated, and a field indicating whether to retrieve the item's attributes if the condition is not met.
  • Delete — Initiates a DeleteItem operation to delete an existing item. This structure specifies the primary key of the item to be deleted, the name of the table where it resides, an optional condition expression that must be satisfied for the deletion to succeed, and a field indicating whether to retrieve the item's attributes if the condition is not met.
  • ConditionCheck — Applies a condition to an item that is not being modified by the transaction. This structure specifies the primary key of the item to be checked, the name of the table where it resides, a condition expression that must be satisfied for the transaction to succeed, and a field indicating whether to retrieve the item's attributes if the condition is not met.

DynamoDB rejects the entire TransactWriteItems request if any of the following is true:

  • A condition in one of the condition expressions is not met.
  • An ongoing operation is in the process of updating the same item.
  • There is insufficient provisioned capacity for the transaction to be completed.
  • An item size becomes too large (bigger than 400 KB), a local secondary index (LSI) becomes too large, or a similar validation error occurs because of changes made by the transaction.
  • The aggregate size of the items in the transaction exceeds 4 MB.
  • There is a user error, such as an invalid data format.

See also: AWS API Documentation

Request Syntax

response = client.transact_write_items(
    TransactItems=[
        {
            'ConditionCheck': {
                'Key': {
                    '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
                    }
                },
                'TableName': 'string',
                'ConditionExpression': 'string',
                'ExpressionAttributeNames': {
                    'string': 'string'
                },
                'ExpressionAttributeValues': {
                    '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
                    }
                },
                'ReturnValuesOnConditionCheckFailure': 'ALL_OLD'|'NONE'
            },
            'Put': {
                '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
                    }
                },
                'TableName': 'string',
                'ConditionExpression': 'string',
                'ExpressionAttributeNames': {
                    'string': 'string'
                },
                'ExpressionAttributeValues': {
                    '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
                    }
                },
                'ReturnValuesOnConditionCheckFailure': 'ALL_OLD'|'NONE'
            },
            'Delete': {
                'Key': {
                    '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
                    }
                },
                'TableName': 'string',
                'ConditionExpression': 'string',
                'ExpressionAttributeNames': {
                    'string': 'string'
                },
                'ExpressionAttributeValues': {
                    '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
                    }
                },
                'ReturnValuesOnConditionCheckFailure': 'ALL_OLD'|'NONE'
            },
            'Update': {
                'Key': {
                    '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
                    }
                },
                'UpdateExpression': 'string',
                'TableName': 'string',
                'ConditionExpression': 'string',
                'ExpressionAttributeNames': {
                    'string': 'string'
                },
                'ExpressionAttributeValues': {
                    '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
                    }
                },
                'ReturnValuesOnConditionCheckFailure': 'ALL_OLD'|'NONE'
            }
        },
    ],
    ReturnConsumedCapacity='INDEXES'|'TOTAL'|'NONE',
    ReturnItemCollectionMetrics='SIZE'|'NONE',
    ClientRequestToken='string'
)
Parameters
  • TransactItems (list) --

    [REQUIRED]

    An ordered array of up to 100 TransactWriteItem objects, each of which contains a ConditionCheck , Put , Update , or Delete object. These can operate on items in different tables, but the tables must reside in the same Amazon Web Services account and Region, and no two of them can operate on the same item.

    • (dict) --

      A list of requests that can perform update, put, delete, or check operations on multiple items in one or more tables atomically.

      • ConditionCheck (dict) --

        A request to perform a check item operation.

        • Key (dict) -- [REQUIRED]

          The primary key of the item to be checked. Each element consists of an attribute name and a value for that attribute.

          • (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
        • TableName (string) -- [REQUIRED]

          Name of the table for the check item request.

        • ConditionExpression (string) -- [REQUIRED]

          A condition that must be satisfied in order for a conditional update to succeed.

        • ExpressionAttributeNames (dict) --

          One or more substitution tokens for attribute names in an expression.

          • (string) --
            • (string) --
        • ExpressionAttributeValues (dict) --

          One or more values that can be substituted in an expression.

          • (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
        • ReturnValuesOnConditionCheckFailure (string) --

          Use ReturnValuesOnConditionCheckFailure to get the item attributes if the ConditionCheck condition fails. For ReturnValuesOnConditionCheckFailure , the valid values are: NONE and ALL_OLD.

      • Put (dict) --

        A request to perform a PutItem operation.

        • Item (dict) -- [REQUIRED]

          A map of attribute name to attribute values, representing the primary key of the item to be written by PutItem . All of the table's primary key attributes must be specified, and their data types must match those of the table's key schema. If any attributes are present in the item that are part of an index key schema for the table, their types must match the index key schema.

          • (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
        • TableName (string) -- [REQUIRED]

          Name of the table in which to write the item.

        • ConditionExpression (string) --

          A condition that must be satisfied in order for a conditional update to succeed.

        • ExpressionAttributeNames (dict) --

          One or more substitution tokens for attribute names in an expression.

          • (string) --
            • (string) --
        • ExpressionAttributeValues (dict) --

          One or more values that can be substituted in an expression.

          • (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
        • ReturnValuesOnConditionCheckFailure (string) --

          Use ReturnValuesOnConditionCheckFailure to get the item attributes if the Put condition fails. For ReturnValuesOnConditionCheckFailure , the valid values are: NONE and ALL_OLD.

      • Delete (dict) --

        A request to perform a DeleteItem operation.

        • Key (dict) -- [REQUIRED]

          The primary key of the item to be deleted. Each element consists of an attribute name and a value for that attribute.

          • (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
        • TableName (string) -- [REQUIRED]

          Name of the table in which the item to be deleted resides.

        • ConditionExpression (string) --

          A condition that must be satisfied in order for a conditional delete to succeed.

        • ExpressionAttributeNames (dict) --

          One or more substitution tokens for attribute names in an expression.

          • (string) --
            • (string) --
        • ExpressionAttributeValues (dict) --

          One or more values that can be substituted in an expression.

          • (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
        • ReturnValuesOnConditionCheckFailure (string) --

          Use ReturnValuesOnConditionCheckFailure to get the item attributes if the Delete condition fails. For ReturnValuesOnConditionCheckFailure , the valid values are: NONE and ALL_OLD.

      • Update (dict) --

        A request to perform an UpdateItem operation.

        • Key (dict) -- [REQUIRED]

          The primary key of the item to be updated. Each element consists of an attribute name and a value for that attribute.

          • (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
        • UpdateExpression (string) -- [REQUIRED]

          An expression that defines one or more attributes to be updated, the action to be performed on them, and new value(s) for them.

        • TableName (string) -- [REQUIRED]

          Name of the table for the UpdateItem request.

        • ConditionExpression (string) --

          A condition that must be satisfied in order for a conditional update to succeed.

        • ExpressionAttributeNames (dict) --

          One or more substitution tokens for attribute names in an expression.

          • (string) --
            • (string) --
        • ExpressionAttributeValues (dict) --

          One or more values that can be substituted in an expression.

          • (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
        • ReturnValuesOnConditionCheckFailure (string) --

          Use ReturnValuesOnConditionCheckFailure to get the item attributes if the Update condition fails. For ReturnValuesOnConditionCheckFailure , the valid values are: NONE, ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW.

  • ReturnConsumedCapacity (string) --

    Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:

    • INDEXES - The response includes the aggregate ConsumedCapacity for the operation, together with ConsumedCapacity for each table and secondary index that was accessed. Note that some operations, such as GetItem and BatchGetItem , do not access any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity information for table(s).
    • TOTAL - The response includes only the aggregate ConsumedCapacity for the operation.
    • NONE - No ConsumedCapacity details are included in the response.
  • ReturnItemCollectionMetrics (string) -- Determines whether item collection metrics are returned. If set to SIZE , the response includes statistics about item collections (if any), that were modified during the operation and are returned in the response. If set to NONE (the default), no statistics are returned.
  • ClientRequestToken (string) --

    Providing a ClientRequestToken makes the call to TransactWriteItems idempotent, meaning that multiple identical calls have the same effect as one single call.

    Although multiple identical calls using the same client request token produce the same result on the server (no side effects), the responses to the calls might not be the same. If the ReturnConsumedCapacity> parameter is set, then the initial TransactWriteItems call returns the amount of write capacity units consumed in making the changes. Subsequent TransactWriteItems calls with the same client token return the number of read capacity units consumed in reading the item.

    A client request token is valid for 10 minutes after the first request that uses it is completed. After 10 minutes, any request with the same client token is treated as a new request. Do not resubmit the same request with the same client token for more than 10 minutes, or the result might not be idempotent.

    If you submit a request with the same client token but a change in other parameters within the 10-minute idempotency window, DynamoDB returns an IdempotentParameterMismatch exception.

    This field is autopopulated if not provided.

Return type

dict

Returns

Response Syntax

{
    'ConsumedCapacity': [
        {
            'TableName': 'string',
            'CapacityUnits': 123.0,
            'ReadCapacityUnits': 123.0,
            'WriteCapacityUnits': 123.0,
            'Table': {
                'ReadCapacityUnits': 123.0,
                'WriteCapacityUnits': 123.0,
                'CapacityUnits': 123.0
            },
            'LocalSecondaryIndexes': {
                'string': {
                    'ReadCapacityUnits': 123.0,
                    'WriteCapacityUnits': 123.0,
                    'CapacityUnits': 123.0
                }
            },
            'GlobalSecondaryIndexes': {
                'string': {
                    'ReadCapacityUnits': 123.0,
                    'WriteCapacityUnits': 123.0,
                    'CapacityUnits': 123.0
                }
            }
        },
    ],
    'ItemCollectionMetrics': {
        'string': [
            {
                'ItemCollectionKey': {
                    '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
                    }
                },
                'SizeEstimateRangeGB': [
                    123.0,
                ]
            },
        ]
    }
}

Response Structure

  • (dict) --

    • ConsumedCapacity (list) --

      The capacity units consumed by the entire TransactWriteItems operation. The values of the list are ordered according to the ordering of the TransactItems request parameter.

      • (dict) --

        The capacity units consumed by an operation. The data returned includes the total provisioned throughput consumed, along with statistics for the table and any indexes involved in the operation. ConsumedCapacity is only returned if the request asked for it. For more information, see Provisioned Throughput in the Amazon DynamoDB Developer Guide .

        • TableName (string) --

          The name of the table that was affected by the operation.

        • CapacityUnits (float) --

          The total number of capacity units consumed by the operation.

        • ReadCapacityUnits (float) --

          The total number of read capacity units consumed by the operation.

        • WriteCapacityUnits (float) --

          The total number of write capacity units consumed by the operation.

        • Table (dict) --

          The amount of throughput consumed on the table affected by the operation.

          • ReadCapacityUnits (float) --

            The total number of read capacity units consumed on a table or an index.

          • WriteCapacityUnits (float) --

            The total number of write capacity units consumed on a table or an index.

          • CapacityUnits (float) --

            The total number of capacity units consumed on a table or an index.

        • LocalSecondaryIndexes (dict) --

          The amount of throughput consumed on each local index affected by the operation.

          • (string) --

            • (dict) --

              Represents the amount of provisioned throughput capacity consumed on a table or an index.

              • ReadCapacityUnits (float) --

                The total number of read capacity units consumed on a table or an index.

              • WriteCapacityUnits (float) --

                The total number of write capacity units consumed on a table or an index.

              • CapacityUnits (float) --

                The total number of capacity units consumed on a table or an index.

        • GlobalSecondaryIndexes (dict) --

          The amount of throughput consumed on each global index affected by the operation.

          • (string) --

            • (dict) --

              Represents the amount of provisioned throughput capacity consumed on a table or an index.

              • ReadCapacityUnits (float) --

                The total number of read capacity units consumed on a table or an index.

              • WriteCapacityUnits (float) --

                The total number of write capacity units consumed on a table or an index.

              • CapacityUnits (float) --

                The total number of capacity units consumed on a table or an index.

    • ItemCollectionMetrics (dict) --

      A list of tables that were processed by TransactWriteItems and, for each table, information about any item collections that were affected by individual UpdateItem , PutItem , or DeleteItem operations.

      • (string) --

        • (list) --

          • (dict) --

            Information about item collections, if any, that were affected by the operation. ItemCollectionMetrics is only returned if the request asked for it. If the table does not have any local secondary indexes, this information is not returned in the response.

            • ItemCollectionKey (dict) --

              The partition key value of the item collection. This value is the same as the partition key value of the item.

              • (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

            • SizeEstimateRangeGB (list) --

              An estimate of item collection size, in gigabytes. This value is a two-element array containing a lower bound and an upper bound for the estimate. The estimate includes the size of all the items in the table, plus the size of all attributes projected into all of the local secondary indexes on that table. Use this estimate to measure whether a local secondary index is approaching its size limit.

              The estimate is subject to change over time; therefore, do not rely on the precision or accuracy of the estimate.

              • (float) --

Exceptions

  • DynamoDB.Client.exceptions.ResourceNotFoundException
  • DynamoDB.Client.exceptions.TransactionCanceledException
  • DynamoDB.Client.exceptions.TransactionInProgressException
  • DynamoDB.Client.exceptions.IdempotentParameterMismatchException
  • DynamoDB.Client.exceptions.ProvisionedThroughputExceededException
  • DynamoDB.Client.exceptions.RequestLimitExceeded
  • DynamoDB.Client.exceptions.InternalServerError