embulk-input-mixpanel 0.5.12 → 0.5.13
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66b8edacf57562c25bb7663220b5c2f85e585da4
|
4
|
+
data.tar.gz: d631d41e6761ba3dc840085d24d9666a0f0b1221
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38cdaa6706bf5ac3b76eb7be40a52ff2473b6e4fe3f7037f9d00ee61cfe35c94d0bd85a3a00d15a1d6486100c5ab1851aee1bce4c54cbeaadc93f90b2396523e
|
7
|
+
data.tar.gz: 0c778717481718ecf4b97c636ec0f5ed6966be18b8687ba0c95941e66726fd4fe543674490a266d5d9948ac31b775574e229030f4efd26cc1159e8e14d9b8acc
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 0.5.13 - 2018-10-04
|
2
|
+
|
3
|
+
* [enhancement] Limit number of returned records in guess and preview [#60](https://github.com/treasure-data/embulk-input-mixpanel/pull/60)
|
4
|
+
|
1
5
|
## 0.5.12 - 2017-02-09
|
2
6
|
|
3
7
|
* [bug] Fix incorrect from_date [#59](https://github.com/treasure-data/embulk-input-mixpanel/pull/59)
|
@@ -11,7 +11,6 @@ module Embulk
|
|
11
11
|
class Mixpanel < InputPlugin
|
12
12
|
Plugin.register_input("mixpanel", self)
|
13
13
|
|
14
|
-
GUESS_RECORDS_COUNT = 10
|
15
14
|
NOT_PROPERTY_COLUMN = "event".freeze
|
16
15
|
|
17
16
|
# https://mixpanel.com/help/questions/articles/special-or-reserved-properties
|
@@ -355,7 +354,7 @@ module Embulk
|
|
355
354
|
end
|
356
355
|
|
357
356
|
def self.guess_from_records(records)
|
358
|
-
sample_props = records.
|
357
|
+
sample_props = records.map {|r| r["properties"]}
|
359
358
|
schema = Guess::SchemaGuess.from_hash_records(sample_props)
|
360
359
|
columns = schema.map do |col|
|
361
360
|
next if col.name == "time"
|
@@ -12,7 +12,7 @@ module Embulk
|
|
12
12
|
PING_TIMEOUT_SECONDS = 3
|
13
13
|
PING_RETRY_LIMIT = 3
|
14
14
|
PING_RETRY_WAIT = 2
|
15
|
-
|
15
|
+
SMALL_NUM_OF_RECORDS = 10
|
16
16
|
DEFAULT_EXPORT_ENDPOINT = "https://data.mixpanel.com/api/2.0/export/".freeze
|
17
17
|
|
18
18
|
attr_reader :retryer
|
@@ -66,7 +66,7 @@ module Embulk
|
|
66
66
|
latest_tried_to_date = to_date
|
67
67
|
params["to_date"] = to_date.strftime("%Y-%m-%d")
|
68
68
|
records = retryer.with_retry do
|
69
|
-
request_small_dataset(params,
|
69
|
+
request_small_dataset(params, SMALL_NUM_OF_RECORDS)
|
70
70
|
end
|
71
71
|
next if records.first.nil?
|
72
72
|
return records
|
@@ -129,16 +129,13 @@ module Embulk
|
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
-
def request_small_dataset(params,
|
132
|
+
def request_small_dataset(params, num_of_records)
|
133
133
|
# guess/preview
|
134
|
-
# Try to fetch first
|
134
|
+
# Try to fetch first number of records
|
135
|
+
params["limit"] = num_of_records
|
135
136
|
set_signatures(params)
|
136
137
|
Embulk.logger.info "Sending request to #{@endpoint}"
|
137
|
-
res = httpclient.get(@endpoint, params
|
138
|
-
if res.code == 416
|
139
|
-
# cannot satisfied requested Range, get full body
|
140
|
-
res = httpclient.get(@endpoint, params)
|
141
|
-
end
|
138
|
+
res = httpclient.get(@endpoint, params)
|
142
139
|
handle_error(res,res.body)
|
143
140
|
response_to_enum(res.body)
|
144
141
|
end
|
@@ -145,7 +145,7 @@ module Embulk
|
|
145
145
|
class ExportSmallDataset < self
|
146
146
|
def test_to_date_after_1_day
|
147
147
|
to = (Date.parse(params["from_date"]) + 1).to_s
|
148
|
-
mock(@client).request_small_dataset(params.merge("to_date" => to), Client::
|
148
|
+
mock(@client).request_small_dataset(params.merge("to_date" => to), Client::SMALL_NUM_OF_RECORDS) { [:foo] }
|
149
149
|
|
150
150
|
@client.export_for_small_dataset(params)
|
151
151
|
end
|
@@ -163,8 +163,8 @@ module Embulk
|
|
163
163
|
stub_client
|
164
164
|
to1 = (Date.parse(params["from_date"]) + 1).to_s
|
165
165
|
to2 = (Date.parse(params["from_date"]) + 10).to_s
|
166
|
-
mock(@client).request_small_dataset(params.merge("to_date" => to1), Client::
|
167
|
-
mock(@client).request_small_dataset(params.merge("to_date" => to2), Client::
|
166
|
+
mock(@client).request_small_dataset(params.merge("to_date" => to1), Client::SMALL_NUM_OF_RECORDS) { [] }
|
167
|
+
mock(@client).request_small_dataset(params.merge("to_date" => to2), Client::SMALL_NUM_OF_RECORDS) { [:foo] }
|
168
168
|
|
169
169
|
@client.export_for_small_dataset(params)
|
170
170
|
end
|
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.
|
4
|
+
version: 0.5.13
|
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: 2018-
|
12
|
+
date: 2018-10-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -239,7 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
239
|
version: '0'
|
240
240
|
requirements: []
|
241
241
|
rubyforge_project:
|
242
|
-
rubygems_version: 2.
|
242
|
+
rubygems_version: 2.4.8
|
243
243
|
signing_key:
|
244
244
|
specification_version: 4
|
245
245
|
summary: Mixpanel input plugin for Embulk
|