【发布时间】:2015-10-24 20:26:52
【问题描述】:
我正在尝试使用 boto 从 python 与 DynamoDB 表进行交互。我希望所有读取/写入都保持仲裁一致性,以确保写入后立即发出的读取始终反映正确的数据。
注意:我的表设置为“phone_number”作为哈希键,first_name+last_name 作为二级索引。就这个问题而言,数据库中存在一个(也是唯一一个)项目(first_name="Paranoid", last_name="Android", phone_number="42")
以下代码按预期工作:
customer = customers.get_item(phone_number="42")
虽然此声明:
customer = customers.get_item(phone_number="42", consistent_read=True)
失败并出现以下错误:
boto.dynamodb2.exceptions.ValidationException: ValidationException: 400 Bad Request
{u'message': u'The provided key element does not match the schema', u'__type': u'com.amazon.coral.validate#ValidationException'}
这可能是由于过去请求失败导致某些隐藏数据损坏的结果吗? (例如以最终一致性执行的两个并发和不同的写入)
提前致谢。
【问题讨论】:
标签: python amazon-dynamodb boto distributed