I'm working on a task where I need to translate fields based on system.
SystemA has it's specific fields and if I want to get SystemB's equivalent for it , I want to query and return result.
我在一个任务,我需要翻译系统的基础上领域的工作。SystemA有它的特定字段,如果我想得到SystemB的等价物,我想查询并返回结果。
I'm new to DynamoDB.Below is dynamodb structure I have.
我是第一次接触DynamoDB。下面是我拥有的DynamoDB结构。
Field_system(Partition) |
Target_system(Sort) |
Value |
John_systemA |
SystemB |
Doe |
Sam_systemA |
SystemB |
Smith |
There could be few thousand entries per system which has different fields.
每个具有不同字段的系统可能有几千个条目。
My initial approach was to loop through list of fields from input and query dynamodb for each element and aggregate result. This would be better than scanning whole table.
我最初的方法是遍历来自输入的字段列表,并为每个元素查询DynamoDB并聚合结果。这比扫描整个表要好。
Is there a better approach or other ways to query for all elements in list at once.
是否有更好的方法或其他方法一次查询列表中的所有元素。
Appreciate feedback and suggestions
感谢反馈和建议
更多回答
优秀答案推荐
For all elements in a list you have a couple of choices.
对于列表中的所有元素,您有几个选择。
If you know both PK and SK for the items, then you can do a BatchGetItem
and return up to 100 items per request.
If the sort key is unknown, you can do an ExecuteStatement
which provides you the ability to do something that would be the equivalent of BatchQuery
which is an API that does not exist. You can specify up to 50 partition keys in your request.
Again if you have a list of partition keys and are looking for the most performant approach, then sending parallel Query
operations per key is the best way to achieve it.
Based on your schema, you may need to create an index with Target System as the partition key.
根据您的架构,您可能需要使用Target System作为分区键来创建索引。
更多回答
我是一名优秀的程序员,十分优秀!