Python 3.x 找不到python boto3批处理写入响应
以下代码将项目批量写入Dynamodb:Python 3.x 找不到python boto3批处理写入响应,python-3.x,amazon-dynamodb,boto3,Python 3.x,Amazon Dynamodb,Boto3,以下代码将项目批量写入Dynamodb: with table.batch_writer() as batch: for item in chunk: dynamodb_item = { 'itemId': item['key'], 'time': item['time'], 'value': item['value'] } ba
with table.batch_writer() as batch:
for item in chunk:
dynamodb_item = {
'itemId': item['key'],
'time': item['time'],
'value': item['value']
}
batch.put_item( Item = dynamodb_item )
如以下文档所述,如果批处理调用失败,则返回未处理的项目:
在boto3中,如何获取响应中未处理的项
我怎样才能确定它是否全部成功处理,或者呼叫响应是否有未处理的项目?使用您提到的
批写项目
,而不是放入项目
选中此项:
您是否尝试过使用批处理写入项()?
response = await client.batch_write_item(
RequestItems=request_items
)
if len(response['UnprocessedItems']) == 0:
print('Wrote 25 items to dynamo')
else:
await asyncio.sleep(5)
unprocessed_items = response['UnprocessedItems']
# proceed with unprocessed_items