Module: Quandl::Cassandra::Batch::Execute::ClassMethods

Defined in:
lib/quandl/cassandra/batch/execute.rb

Instance Method Summary collapse

Instance Method Details

#batch_sizeObject



16
17
18
# File 'lib/quandl/cassandra/batch/execute.rb', line 16

def batch_size
  Quandl::Cassandra.configuration.batch_size
end

#execute(rows, &block) ⇒ Object

Quandl::Cassandra::Batch.insert(rows) do |id, type, time, value|

"INSERT INTO columns (id, type, time, value) VALUES (#{id}, '#{type}', #{time}, #{value})"

end



10
11
12
13
14
# File 'lib/quandl/cassandra/batch/execute.rb', line 10

def execute(rows, &block)
  execute_in_batches(rows, &block)
rescue => e
  raise $!, "#{block.call(*rows.first)} #{$!}", $!.backtrace
end