ITADN

DynamoDB `batch_write_item` fails for binary attributes in moto 5.2.0

#10006Closedjrobbins-LiveData 创建于 2026-05-02
regression
## Title DynamoDB `batch_write_item` fails for binary attributes in moto 5.2.0 ## Summary After upgrading from `moto==5.1.22` to `moto==5.2.0`, DynamoDB `batch_write_item` fails when a `PutRequest` contains a binary (`B`) attribute whose value is `bytes`. This appears to be a regression in moto's DynamoDB duplicate detection. The same isolated repro passes on `moto==5.1.22` and fails on `moto==5.2.0`. ## Environment - Python: 3.13.7 - boto3: 1.43.2 - botocore: 1.43.2 - moto: 5.2.0 - OS: Windows ## Minimal Reproduction ```python import boto3 import moto from moto import mock_aws print("moto", moto.__version__) @mock_aws def main(): ddb = boto3.client("dynamodb", region_name="us-east-1") ddb.create_table( TableName="binary-state-test", AttributeDefinitions=[{"AttributeName": "pk", "AttributeType": "S"}], KeySchema=[{"AttributeName": "pk", "KeyType": "HASH"}], BillingMode="PAY_PER_REQUEST", ) ddb.batch_write_item( RequestItems={ "binary-state-test": [ { "PutRequest": { "Item": { "pk": {"S": "state-1"}, "blob": {"B": b"\x28\xb5\x2f\xfd\x00\x01"}, } } } ] } ) print("binary batch_write_item ok") main()
关闭于 2026-05-03 0 条评论