如果我将字符串插入 DynamoDB,但其长度超过 400 KB 的限制,会发生什么情况?



我不认为 DynamoDB 会将字符串削减到 400KB,因为这不安全。那么,当我尝试插入长度超过限制的字符串时,DynamoDB 会引发错误吗?

根据您使用的语言,您会收到例外。基本上,它将是第 400 个 HTTP 代码的包装器,由低级 DynamoDB REST API 返回:

像这样:

ValidationException: ValidationException: 400 Bad Request
{u'message': u'Item size has exceeded the maximum allowed size', u'__type': u'com.amazon.coral.validate#ValidationException'}

或:

Item size to update has exceeded the maximum allowed size (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ValidationException; Request ID: XXXXXXXXXXXXXXXXXXXXXXXXXXXX)

或:

Could not write to DynamoDB: ValidationException: ExpressionAttributeValues contains invalid value: Item size has exceeded the maximum allowed size for key :largeAttribute status code: 400, request id: XXXXXXXXXXXXXXXXXXXXXXXXXXXX

相关内容