0
我試圖用AWS Ruby SDK(v1)例如Item
類的delete
方法刪除AWS SimpleDB域中的一堆記錄。AWS SimpleDB Ruby v1 SDK刪除方法不起作用
expected_total = # fetched using a count(*) query
actually_deleted = 0
query = "select * from MyDomain where Attr = '#{attr_value}'"
token = nil
begin
if token == nil then
resp = sdb.select(select_expression: query)
else
resp = sdb.select(
select_expression: query,
next_token: token)
end
token = resp[:next_token]
resp[:items].each do |item|
item.delete({})
actually_deleted += 1
print "\rDeleted #{actually_deleted} records..." if actually_deleted % 250 == 0
end
end while token != nil && token != ''
puts "\nComplete. Expected: #{expected_total} Actual: {actually_deleted}"
完成後,它報告預期的記錄數已被刪除,但它們沒有。他們在SimpleDB中仍然存在。我最初認爲這可能是一個複製問題,我過早檢查。但是,我運行腳本的次數並不重要,它從不刪除記錄。
Here's the docs我正在使用的刪除方法。