embulk-plugin-input-sfdc-event-log-files 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/embulk/input_sfdc_event_log_files.rb +7 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1de6f77dda618e88001e7dcde3c6df71dff8ca7
|
4
|
+
data.tar.gz: 97f3cd3e1595157a0a919c45282c302f71d8e558
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdf820206419e15dcddb801737d6b77aa9dc45c732842d3c1b1782c2fee8416dcdda805f81658b7a6bfaf46a05b03dfe84012c74cbfbe01c30be3dee66443111
|
7
|
+
data.tar.gz: 12c78ada690b806fbff2353589b955f4082774cd6ce461b37a22899a75beb29a555acceb443f1f1ab13e5d889b86206e82d841bbe30afcc94000625912dd0bf0
|
@@ -42,8 +42,7 @@ module Embulk
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def run(task, schema, index, page_builder)
|
45
|
-
|
46
|
-
new(task, index, page_builder).run
|
45
|
+
new(task, schema, index, page_builder).run
|
47
46
|
end
|
48
47
|
|
49
48
|
private
|
@@ -88,7 +87,8 @@ module Embulk
|
|
88
87
|
end
|
89
88
|
end
|
90
89
|
|
91
|
-
def initialize(task, index, page_builder)
|
90
|
+
def initialize(task, schema, index, page_builder)
|
91
|
+
@schema = schema
|
92
92
|
@page_builder = page_builder
|
93
93
|
@records = task['records']
|
94
94
|
@last_log_date = Time.parse(task['last_log_date'])
|
@@ -96,13 +96,15 @@ module Embulk
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def run
|
99
|
+
columns = @schema.map { |c| c.name }
|
100
|
+
@page_builder.finish
|
99
101
|
@records.each do |record|
|
100
102
|
event_type = record['EventType']
|
101
103
|
@last_log_date = [@last_log_date, Time.parse(record['LogDate']).to_i].max
|
102
104
|
log_file = record['LogFile']
|
103
105
|
CSV.parse(@client.get_content(log_file), headers: true) do |row|
|
104
|
-
row['
|
105
|
-
@page_builder.add(row)
|
106
|
+
row['TIMESTAMP'] = Time.parse(row['TIMESTAMP']).to_i
|
107
|
+
@page_builder.add(row.to_hash.values_at(*columns))
|
106
108
|
end
|
107
109
|
end
|
108
110
|
@page_builder.finish unless @records.empty?
|