quandl_cassandra 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/UPGRADE.md +5 -0
- data/lib/quandl/cassandra/batch/{insert.rb → execute.rb} +6 -6
- data/lib/quandl/cassandra/batch.rb +2 -2
- data/lib/quandl/cassandra/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fbb24fa9c17d9297a69788b91e16f2bfe5d04ef
|
4
|
+
data.tar.gz: fbd7d1d238a56ebcdecb6d520b30cc0dcbf5b011
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53675199c920cb9fa40749cfcbb62bd5be28e53e2eb157ea748a8caab81e55371b4e89508263f792659c5048b068e6e1f424d25babd0b06de2256ebfb3d547c6
|
7
|
+
data.tar.gz: d886dcb2fc3ae6517cd82366f6a33f405887cad03cf816d408c8e3496193670a9e419873b3c7d51af026b12c5ccf2a478d39db91fec3fe6470c99cc6e44f1f09
|
data/UPGRADE.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
module Quandl::Cassandra::Batch::
|
1
|
+
module Quandl::Cassandra::Batch::Execute
|
2
2
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
@@ -7,8 +7,8 @@ module Quandl::Cassandra::Batch::Insert
|
|
7
7
|
# Quandl::Cassandra::Batch.insert(rows) do |id, type, time, value|
|
8
8
|
# "INSERT INTO columns (id, type, time, value) VALUES (#{id}, '#{type}', #{time}, #{value})"
|
9
9
|
# end
|
10
|
-
def
|
11
|
-
|
10
|
+
def execute(rows, &block)
|
11
|
+
execute_in_batches(rows, &block)
|
12
12
|
end
|
13
13
|
|
14
14
|
def batch_size
|
@@ -18,15 +18,15 @@ module Quandl::Cassandra::Batch::Insert
|
|
18
18
|
|
19
19
|
protected
|
20
20
|
|
21
|
-
def
|
21
|
+
def execute_in_batches_with_threads(rows, &block)
|
22
22
|
# split rows into groups by rows_per_thread
|
23
23
|
threads = rows.each_slice( rows_per_thread(rows) ).map do |rows_slice|
|
24
|
-
Thread.start{
|
24
|
+
Thread.start{ execute_in_batches(rows_slice, &block) }
|
25
25
|
end
|
26
26
|
threads.each(&:join)
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
29
|
+
def execute_in_batches(rows, &block)
|
30
30
|
futures = []
|
31
31
|
rows.each_slice( batch_size ).each do |rows_slice|
|
32
32
|
statements = rows_slice.collect{|row| block.call( *row ) }
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'quandl/cassandra/batch/logging'
|
2
|
-
require 'quandl/cassandra/batch/
|
2
|
+
require 'quandl/cassandra/batch/execute'
|
3
3
|
|
4
4
|
class Quandl::Cassandra::Batch
|
5
5
|
|
6
|
-
include Quandl::Cassandra::Batch::
|
6
|
+
include Quandl::Cassandra::Batch::Execute
|
7
7
|
include Quandl::Cassandra::Batch::Logging if defined?(QUANDL_LOGGER) && QUANDL_LOGGER == true
|
8
8
|
|
9
9
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quandl_cassandra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blake Hilscher
|
@@ -189,7 +189,7 @@ files:
|
|
189
189
|
- lib/quandl/cassandra/base/schema.rb
|
190
190
|
- lib/quandl/cassandra/base/scoping.rb
|
191
191
|
- lib/quandl/cassandra/batch.rb
|
192
|
-
- lib/quandl/cassandra/batch/
|
192
|
+
- lib/quandl/cassandra/batch/execute.rb
|
193
193
|
- lib/quandl/cassandra/batch/logging.rb
|
194
194
|
- lib/quandl/cassandra/configuration.rb
|
195
195
|
- lib/quandl/cassandra/error.rb
|