lib/ddbcli/ddb-driver.rb in ddbcli-0.4.0 vs lib/ddbcli/ddb-driver.rb in ddbcli-0.4.1

- old
+ new

@@ -576,11 +576,14 @@ req_hash['ProvisionedThroughput'] = { 'ReadCapacityUnits' => parsed.capacity[:read], 'WriteCapacityUnits' => parsed.capacity[:write], } else - req_hash['ProvisionedThroughput'] = table_info['ProvisionedThroughput'] + req_hash['ProvisionedThroughput'] = { + 'ReadCapacityUnits' => table_info['ProvisionedThroughput']['ReadCapacityUnits'], + 'WriteCapacityUnits' => table_info['ProvisionedThroughput']['WriteCapacityUnits'], + } end @client.query('CreateTable', req_hash) nil end @@ -992,9 +995,14 @@ operations << { 'PutRequest' => { 'Item' => h, }, } + + + if parsed.attrs.length != val_list.length + raise DynamoDB::Error, "number of attribute name and value are different: #{parsed.attrs.inspect} != #{val_list.inspect}" + end parsed.attrs.zip(val_list).each do |name, val| h[name] = convert_to_attribute_value(val) end end