简体   繁体   English

DynamoDB GetItemResult GetItem用于多个项目

[英]DynamoDB GetItemResult GetItem for multiple items

As I understand it, the return value for GetItem is Map<String,AttributeValue> . 据我了解,GetItem的返回值是Map<String,AttributeValue> This is a map of attribute name to attribute value for a single item, a row, in the DB. 这是数据库中单个项目(一行)的属性名称到属性值的映射。

What if the hash and range values don't result in an unique result? 如果哈希值和范围值未产生唯一结果怎么办? Does the SDK throw an exception or something? SDK是否会引发异常? My table is set up so that with hash and range attributes I set I will generally not get unique results. 设置我的表是为了使我设置的hash和range属性通常不会获得唯一的结果。

I understand I can do a query and get multiple items back, but it is more expensive and slower? 我知道我可以进行查询并取回多个项目,但是更贵,更慢?

The composite key hash + range should result in unique result only. 复合键hash + range应仅导致唯一结果。
If you have a table with both hash and range key then dynamo db will override the previous value of the row with the same hash and range value. 如果您的表同时具有hash and rangehash and range键,那么dynamo db将使用相同的hash and range值覆盖该行的先前值。

So this is not possible --> 所以这不可能 ->

My table is set up so that with hash and range attributes I set I will generally not get unique results. 设置我的表是为了使我设置的hash和range属性通常不会获得唯一的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM