我从他们的文档中看到您可以为单个项目 batch_get_item
但我不太确定如何从带有哈希范围键的表中获取项目。特别是批量获取仅具有哈希值的项目,这可能吗?
你可以按照这个代码:
dynamodb = boto3.resource('dynamodb')
r = dynamodb.batch_get_item(RequestItems={
'TABLE_NAME': {
'Keys': [
{
'myPrimaryKey': "123",
'mySortKey': "65894"
},
{
'myPrimaryKey': "123",
'mySortKey': "65004"
},
{
'myPrimaryKey': "123",
'mySortKey': "69654"
}
],
},
})
print(r["Responses"]["TABLE_NAME"])
print(r["UnprocessedKeys"])
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1041 次 |
| 最近记录: |