mode 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7d69ae05d944f46182074adaa084e4b22454862
4
- data.tar.gz: 111e422dca6963652e892f4543f6b91d13d4bf1e
3
+ metadata.gz: bafc28cae256c4ce4821bb00753799dadb4c468c
4
+ data.tar.gz: 7360d725309e1253b0cff15f9974942405fbd370
5
5
  SHA512:
6
- metadata.gz: f33ca37d31a1966328a8dadaef02eb0337aac0fcd28be3473b8d21ee50f777023132cfa886641a96b97804bc6d18e640c1bc3f6f101b9d7cc6344158f30a3acd
7
- data.tar.gz: df765cb61dd992ec67ce3cd3fe11a04a65d8d45927ca0cb43a6ffa338a487211e5421e2fd24525e53d8c962671597bb34280b54c8ddf2eb594e6b39a5777502d
6
+ metadata.gz: 1e6ffd7b71345345d3e8399c74a7b6b358353ae632839ac60f46085cb0cbfaed4c09f4e2a748429ece0df50ed802095977adf605b92812e462544b2a864c4e56
7
+ data.tar.gz: 9bd2f1c0f0f3fe7f788a83785d7d1b591d6e355231ea3507dcf70db113e44d1ffc5c44b08cda7a0d65bd3a469ffd481ae8b9f8e781f1536d06f748752ca0a4bd
@@ -2,10 +2,13 @@ module Mode
2
2
  module Connector
3
3
  class Dataset
4
4
  attr_reader :path
5
+
6
+ attr_reader :count
5
7
  attr_reader :column_types
6
8
 
7
- def initialize(path, column_types)
9
+ def initialize(path, count, column_types)
8
10
  @path = path
11
+ @count = count
9
12
  @column_types = column_types
10
13
  end
11
14
  end
@@ -5,16 +5,18 @@ module Mode
5
5
  class Selector
6
6
  attr_reader :query
7
7
  attr_reader :data_source
8
+
9
+ attr_reader :count
8
10
  attr_reader :column_types
9
11
 
10
12
  def initialize(query, data_source)
11
13
  @query, @data_source = query, data_source
12
- @column_types = Mode::Connector::TypeMap.new
14
+ @count, @column_types = 0, Mode::Connector::TypeMap.new
13
15
  end
14
16
 
15
17
  def perform!
16
18
  File.open(path, 'w+') { |file| write(file) }
17
- Mode::Connector::Dataset.new(path, column_types)
19
+ Mode::Connector::Dataset.new(path, count, column_types)
18
20
  end
19
21
 
20
22
  def path
@@ -27,6 +29,7 @@ module Mode
27
29
  index = 0
28
30
  file.write '['
29
31
  data_source.select(query) do |row|
32
+ @count += 1
30
33
  write_row(file, row, index += 1)
31
34
  end
32
35
  file.write ']'
@@ -14,6 +14,7 @@ module Mode
14
14
  path,
15
15
  :execution => {
16
16
  :dataset => {
17
+ :count => count,
17
18
  :content => content,
18
19
  :columns => JSON.generate(columns)
19
20
  }
@@ -36,6 +37,10 @@ module Mode
36
37
 
37
38
  private
38
39
 
40
+ def count
41
+ dataset.count
42
+ end
43
+
39
44
  def columns
40
45
  dataset.column_types.map do |name, type|
41
46
  {:name => name, :type => type}
@@ -1,3 +1,3 @@
1
1
  module Mode
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -8,6 +8,7 @@ describe Mode::Connector::Uploader do
8
8
  let(:dataset) {
9
9
  double(:dataset,
10
10
  :path => outpath,
11
+ :count => 0,
11
12
  :column_types => {
12
13
  'int' => :integer,
13
14
  'float' => :number
@@ -31,6 +32,7 @@ describe Mode::Connector::Uploader do
31
32
  Mode::API::Request.should_receive(:put).with(execution_path,
32
33
  :execution => {
33
34
  :dataset => {
35
+ :count => 0,
34
36
  :columns => an_instance_of(String),
35
37
  :content => an_instance_of(Faraday::UploadIO)
36
38
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mode Analytics