DDB transaction limit increased to 100 (#5696)

This commit is contained in:
rafcio19 2022-11-22 17:25:47 +00:00 committed by GitHub
parent 4008011a7b
commit d6c438400e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

View File

@ -229,7 +229,10 @@ class MultipleTransactionsException(MockValidationException):
class TooManyTransactionsException(MockValidationException): class TooManyTransactionsException(MockValidationException):
msg = "Validation error at transactItems: Member must have length less than or equal to 25." msg = (
"1 validation error detected at 'transactItems' failed to satisfy constraint: "
"Member must have length less than or equal to 100."
)
def __init__(self): def __init__(self):
super().__init__(self.msg) super().__init__(self.msg)

View File

@ -1648,7 +1648,7 @@ class DynamoDBBackend(BaseBackend):
return table.ttl return table.ttl
def transact_write_items(self, transact_items): def transact_write_items(self, transact_items):
if len(transact_items) > 25: if len(transact_items) > 100:
raise TooManyTransactionsException() raise TooManyTransactionsException()
# Create a backup in case any of the transactions fail # Create a backup in case any of the transactions fail
original_table_state = copy.deepcopy(self.tables) original_table_state = copy.deepcopy(self.tables)

View File

@ -555,12 +555,15 @@ def test_transact_write_items__too_many_transactions():
with pytest.raises(ClientError) as exc: with pytest.raises(ClientError) as exc:
dynamodb.transact_write_items( dynamodb.transact_write_items(
TransactItems=[ TransactItems=[
update_email_transact(f"test{idx}@moto.com") for idx in range(26) update_email_transact(f"test{idx}@moto.com") for idx in range(101)
] ]
) )
err = exc.value.response["Error"] err = exc.value.response["Error"]
err["Code"].should.equal("ValidationException") err["Code"].should.equal("ValidationException")
err["Message"].should.match("Member must have length less than or equal to 25") err["Message"].should.match(
"1 validation error detected at 'transactItems' failed to satisfy constraint: "
"Member must have length less than or equal to 100."
)
@mock_dynamodb @mock_dynamodb