embulk-input-mixpanel 0.5.5 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: feae04dbd0d3d9eebea301fecf14418a588723d4
4
- data.tar.gz: 0ae3937206d959f34f1d542297925388f616f31b
3
+ metadata.gz: 4244a94a3544327e669c32d73c2ccee585995447
4
+ data.tar.gz: 626163f5745eb15632ba40f53322a406e1aa2281
5
5
  SHA512:
6
- metadata.gz: 742c1956e206d8876f40bf564b40d072cf4f8416850e10584228a4f290a889a2171354b94ce23e2f1b84cbb28e3401e640ea4f4084648b43de0a0ac0ea91d158
7
- data.tar.gz: 3827c9c15d5db544261a1c666286ed4a465d8caf42a1cce0ab21f55e7092c9322430df180ec0b08af645df3de271fe461885863388a2aa019ccbaa4a8d27de79
6
+ metadata.gz: 4d5261a04ea1ec237282956ffd68423974ba3e84858a77e4fd7b86f4f86984453111e60d0671ad539131ebf435da160793fad7389f0e134652b4d19618de91f5
7
+ data.tar.gz: 4a427ea5b7f21463b6fc608afb9dc9d39d6ff1cd94383aabee10d7f89205fd43f87e611d2de1df2653e0afd869527b7866d9552e77d2a3562fa7c56ef5a7ef46
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.5.6 - 2017-09-20
2
+ * [bug] Fix issue when back_fill data get processed by Mixpanel when plugin is running [#54](https://github.com/treasure-data/embulk-input-mixpanel/pull/54)
3
+
4
+ ## 0.5.5 - 2017-09-11
5
+ * [enhancement] Add slice_range configuration [#52](https://github.com/treasure-data/embulk-input-mixpanel/pull/52)
6
+
1
7
  ## 0.5.4 - 2017-08-15
2
8
  * [bug] Fix a bug when `fetch_days` is 1 plugin will fetch 2 days instead of 1 [#51](https://github.com/treasure-data/embulk-input-mixpanel/pull/51)
3
9
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "embulk-input-mixpanel"
3
- spec.version = "0.5.5"
3
+ spec.version = "0.5.6"
4
4
  spec.authors = ["yoshihara", "uu59"]
5
5
  spec.summary = "Mixpanel input plugin for Embulk"
6
6
  spec.description = "Loads records from Mixpanel."
@@ -159,13 +159,13 @@ module Embulk
159
159
  prev_latest_fetched_time = task[:latest_fetched_time] || 0
160
160
  prev_latest_fetched_time_format = Time.at(prev_latest_fetched_time).strftime("%F %T %z")
161
161
  current_latest_fetched_time = prev_latest_fetched_time
162
- @dates.each_slice(task[:slice_range]) do |dates|
162
+ @dates.each_slice(task[:slice_range]) do |sliced_dates|
163
163
  ignored_record_count = 0
164
164
  unless preview?
165
- Embulk.logger.info "Fetching data from #{dates.first} to #{dates.last} ..."
165
+ Embulk.logger.info "Fetching data from #{@dates.first} to #{sliced_dates.last} ..."
166
166
  end
167
167
  record_time_column=@incremental_column || DEFAULT_TIME_COLUMN
168
- fetch(dates, prev_latest_fetched_time).each do |record|
168
+ fetch([@dates.first, sliced_dates.last], prev_latest_fetched_time).each do |record|
169
169
  if @incremental
170
170
  if !record["properties"].include?(record_time_column)
171
171
  raise Embulk::ConfigError.new("Incremental column not exists in fetched data #{record_time_column}")
@@ -193,6 +193,7 @@ module Embulk
193
193
  end
194
194
  page_builder.add(values)
195
195
  end
196
+ prev_latest_fetched_time = [current_latest_fetched_time, prev_latest_fetched_time].max
196
197
  if ignored_record_count > 0
197
198
  Embulk.logger.warn "Skipped already loaded #{ignored_record_count} records. These record times are older or equal than previous fetched record time (#{prev_latest_fetched_time} @ #{prev_latest_fetched_time_format})."
198
199
  end
@@ -571,7 +571,7 @@ module Embulk
571
571
 
572
572
  def test_run
573
573
  stub(@plugin).preview? { false }
574
- mock(@page_builder).add(anything).times(records.length * 2)
574
+ mock(@page_builder).add(anything).times(records.length)
575
575
  mock(@page_builder).finish
576
576
 
577
577
  @plugin.run
@@ -580,7 +580,7 @@ module Embulk
580
580
  def test_timezone
581
581
  stub(@plugin).preview? { false }
582
582
  adjusted = record_epoch - timezone_offset_seconds
583
- mock(@page_builder).add(["FOO", adjusted, "event"]).times(records.length * 2)
583
+ mock(@page_builder).add(["FOO", adjusted, "event"]).times(records.length)
584
584
  mock(@page_builder).finish
585
585
 
586
586
  @plugin.run
@@ -592,9 +592,9 @@ module Embulk
592
592
  plugin = Mixpanel.new(task.merge(slice_range: 2), nil, nil, @page_builder)
593
593
  stub(plugin).preview? {false}
594
594
  stub(plugin).fetch(["2015-02-22", "2015-02-23"],0){[]}
595
- stub(plugin).fetch(["2015-02-24", "2015-02-25"],0){[]}
596
- stub(plugin).fetch(["2015-02-26", "2015-02-27"],0){[]}
597
- stub(plugin).fetch(["2015-02-28", "2015-03-01"],0){[]}
595
+ stub(plugin).fetch(["2015-02-22", "2015-02-25"],0){[]}
596
+ stub(plugin).fetch(["2015-02-22", "2015-02-27"],0){[]}
597
+ stub(plugin).fetch(["2015-02-22", "2015-03-01"],0){[]}
598
598
  mock(@page_builder).finish
599
599
  plugin.run
600
600
  end
@@ -644,8 +644,14 @@ module Embulk
644
644
  mock(page_builder).add(["FOO", adjusted, "event"]).times(records.length * 2)
645
645
  mock(page_builder).finish
646
646
  any_instance_of(MixpanelApi::Client) do |klass|
647
- stub(klass).export() do |params, block|
648
- assert_equal('(abc==def) and properties["mp_processing_time_ms"] > 1',params["where"])
647
+ stub(klass).export(satisfy{|params|
648
+ '(abc==def) and properties["mp_processing_time_ms"] > 1'==params["where"]
649
+ }).once do |params, block|
650
+ records.each{|record| block.call(record) }
651
+ end
652
+ stub(klass).export(satisfy{|params|
653
+ '(abc==def) and properties["mp_processing_time_ms"] > 1234567919'==params["where"]
654
+ }).once do |params, block|
649
655
  records.each{|record| block.call(record) }
650
656
  end
651
657
  end
@@ -661,8 +667,14 @@ module Embulk
661
667
  mock(page_builder).add(["FOO", adjusted, "event"]).times(records.length * 2)
662
668
  mock(page_builder).finish
663
669
  any_instance_of(MixpanelApi::Client) do |klass|
664
- stub(klass).export() do |params, block|
665
- assert_equal('properties["mp_processing_time_ms"] > 1',params["where"])
670
+ stub(klass).export(satisfy {|params|
671
+ 'properties["mp_processing_time_ms"] > 1'==params["where"]
672
+ }).once() do |params,block|
673
+ records.each{|record| block.call(record) }
674
+ end
675
+ stub(klass).export(satisfy {|params|
676
+ 'properties["mp_processing_time_ms"] > 1234567919' == params["where"]
677
+ }).once() do |params,block|
666
678
  records.each{|record| block.call(record) }
667
679
  end
668
680
  end
@@ -770,7 +782,7 @@ module Embulk
770
782
  {"int" => properties["int"], "event" => record["event"]}.to_json
771
783
  ]
772
784
 
773
- mock(@page_builder).add(added).times(records.length * 2)
785
+ mock(@page_builder).add(added).times(records.length)
774
786
  mock(@page_builder).finish
775
787
 
776
788
  @plugin.run
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-mixpanel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshihara
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-09-11 00:00:00.000000000 Z
12
+ date: 2017-09-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement
@@ -224,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
224
  version: '0'
225
225
  requirements: []
226
226
  rubyforge_project:
227
- rubygems_version: 2.6.6
227
+ rubygems_version: 2.4.8
228
228
  signing_key:
229
229
  specification_version: 4
230
230
  summary: Mixpanel input plugin for Embulk