http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Scan.html
http://docs.aws.amazon.com/sdkforruby/api/Aws/DynamoDB/Client.html
DynamoDB's scan
operation fetches only 1MB at one time and it adds LastEvaluatedKey
(LEK) in the response if it has a next page.
I didn't know the spec and troubled a bit in my project.
items = []
scan_opts = {
table_name: "MyDynamoTable",
scan_filter: {
"PublishedAt" => {
attribute_value_list: ["2017-08-25"],
comparison_operator: "GE",
},
"Host" => {
attribute_value_list: ["example.com"],
comparison_operator: "EQ",
}
},
consistent_read: true,
}
scan_output = client.scan scan_opts
loop do
items << scan_output.items
break unless (lek = scan_output.last_evaluated_key)
scan_output = client.scan scan_opts.merge(exclusive_start_key: lek)
end
items.flatten
@michael-bowen-sp thanks for comment!
This is an old code and I have no re-pro environment now. but you mean I should do like the following?
If I'm wrong, please tell me in code ๐