embulk-output-vertica 0.7.3 → 0.7.4

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: 7e89fddffd4579262fb1d91d92a3288c0e8a8ba2
4
- data.tar.gz: e5708526eb702e7008e2758126251a4e306e75f1
3
+ metadata.gz: 8a242b2cf1e51a66b6437732cbe452462e4c8cf2
4
+ data.tar.gz: c246522c98e21f209d91b68eb822963b85b72f4f
5
5
  SHA512:
6
- metadata.gz: efa9d97f5d999a983f4d55ffc5cb5413bf1b9da63f825276682e01c14fbdc9541da1277a108b2b639f9960f7e6af21f4b1c7b99894ca51ae1954814e777e5e27
7
- data.tar.gz: c4c1b97985f3211d187192b8581f1602109cb2eb9b2d1f58dc05e30e232a7b823e00fd7b76831fea95883b80232e759d632d621892f3c69429612cf3b5e1fe12
6
+ metadata.gz: d5b433c8a06ad2c3d0be6fc90d9bc31e0e4a919bd292e7a994d9dace14587ee5cbcc09f05c5760d3f0f02c4504d6ee94bc3fd39ad7c453d7acadb1a93967ae59
7
+ data.tar.gz: 1a3f92018cbcfa04ed2e5cd18a07459ec2e2288398bc5e6422c3aa6d6b842be68b32aa4290135f307d22be7cd4f8d740d72649adeb7580961c36f6bd2aa04c33
@@ -1,3 +1,9 @@
1
+ # 0.7.4 (2016/05/07)
2
+
3
+ Fixes:
4
+
5
+ * Add missing "require 'timeout'"
6
+
1
7
  # 0.7.3 (2016/03/27)
2
8
 
3
9
  Enhancements:
data/README.md CHANGED
@@ -75,7 +75,7 @@ Run example:
75
75
 
76
76
  ```
77
77
  $ embulk bundle install --path vendor/bundle
78
- $ embulk -J-O -R--dev run -b . -l debug example.yml
78
+ $ embulk -J-O -R--dev run -b . -l debug example/example.yml
79
79
  ```
80
80
 
81
81
  Release gem:
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "embulk-output-vertica"
3
- spec.version = "0.7.3"
3
+ spec.version = "0.7.4"
4
4
  spec.authors = ["Naotoshi Seo", "Eiji Sekiya"]
5
5
  spec.email = ["sonots@gmail.com", "eiji.sekiya.0326@gmail.com"]
6
6
  spec.summary = "Vertica output plugin for Embulk"
@@ -1,4 +1,5 @@
1
1
  require 'jvertica'
2
+ require 'securerandom'
2
3
  require_relative 'vertica/value_converter_factory'
3
4
  require_relative 'vertica/output_thread'
4
5
 
@@ -14,6 +15,23 @@ module Embulk
14
15
  @thread_pool ||= @thread_pool_proc.call
15
16
  end
16
17
 
18
+ def self.transaction_report(jv, task, task_reports)
19
+ quoted_schema = ::Jvertica.quote_identifier(task['schema'])
20
+ quoted_temp_table = ::Jvertica.quote_identifier(task['temp_table'])
21
+
22
+ num_input_rows = task_reports.map {|report| report['num_input_rows'].to_i }.inject(:+)
23
+ num_response_rows = task_reports.map {|report| report['num_output_rows'].to_i }.inject(:+)
24
+ result = query(jv, %[SELECT COUNT(*) FROM #{quoted_schema}.#{quoted_temp_table}])
25
+ num_output_rows = result.map {|row| row.values }.flatten.first.to_i
26
+ num_rejected_rows = num_input_rows - num_output_rows
27
+ transaction_report = {
28
+ 'num_input_rows' => num_input_rows,
29
+ 'num_response_rows' => num_response_rows,
30
+ 'num_output_rows' => num_output_rows,
31
+ 'num_rejected_rows' => num_rejected_rows,
32
+ }
33
+ end
34
+
17
35
  def self.transaction(config, schema, task_count, &control)
18
36
  task = {
19
37
  'host' => config.param('host', :string, :default => 'localhost'),
@@ -65,7 +83,7 @@ module Embulk
65
83
  end
66
84
 
67
85
  now = Time.now
68
- unique_name = "%08x%08x" % [now.tv_sec, now.tv_nsec]
86
+ unique_name = SecureRandom.uuid
69
87
  task['temp_table'] = "#{task['table']}_LOAD_TEMP_#{unique_name}"
70
88
 
71
89
  quoted_schema = ::Jvertica.quote_identifier(task['schema'])
@@ -108,6 +126,16 @@ module Embulk
108
126
  Embulk.logger.info { "embulk-output-vertica: task_reports: #{task_reports.to_json}" }
109
127
 
110
128
  connect(task) do |jv|
129
+ transaction_report = self.transaction_report(jv, task, task_reports)
130
+ Embulk.logger.info { "embulk-output-vertica: transaction_report: #{transaction_report.to_json}" }
131
+
132
+ if task['abort_on_error'] # double-meaning, also used for COPY statement
133
+ if transaction_report['num_input_rows'] != transaction_report['num_output_rows']
134
+ raise Error, "ABORT: `num_input_rows (#{transaction_report['num_input_rows']})` and " \
135
+ "`num_output_rows (#{transaction_report['num_output_rows']})` does not match"
136
+ end
137
+ end
138
+
111
139
  if task['mode'] == 'REPLACE'
112
140
  # swap table and drop the old table
113
141
  quoted_old_table = ::Jvertica.quote_identifier("#{task['table']}_LOAD_OLD_#{unique_name}")
@@ -1,4 +1,5 @@
1
1
  require 'zlib'
2
+ require 'timeout'
2
3
 
3
4
  module Embulk
4
5
  module Output
metadata CHANGED
@@ -1,72 +1,72 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-output-vertica
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo
8
8
  - Eiji Sekiya
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-03-27 00:00:00.000000000 Z
12
+ date: 2016-05-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jvertica
16
- requirement: !ruby/object:Gem::Requirement
16
+ version_requirements: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: 0.2.2
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
21
+ requirement: !ruby/object:Gem::Requirement
24
22
  requirements:
25
23
  - - ">="
26
24
  - !ruby/object:Gem::Version
27
25
  version: 0.2.2
26
+ prerelease: false
27
+ type: :runtime
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: tzinfo
30
- requirement: !ruby/object:Gem::Requirement
30
+ version_requirements: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
35
+ requirement: !ruby/object:Gem::Requirement
38
36
  requirements:
39
37
  - - ">="
40
38
  - !ruby/object:Gem::Version
41
39
  version: '0'
40
+ prerelease: false
41
+ type: :runtime
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: bundler
44
- requirement: !ruby/object:Gem::Requirement
44
+ version_requirements: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: '1.7'
49
- type: :development
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
49
+ requirement: !ruby/object:Gem::Requirement
52
50
  requirements:
53
51
  - - "~>"
54
52
  - !ruby/object:Gem::Version
55
53
  version: '1.7'
54
+ prerelease: false
55
+ type: :development
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rake
58
- requirement: !ruby/object:Gem::Requirement
58
+ version_requirements: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
62
  version: '10.0'
63
- type: :development
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
63
+ requirement: !ruby/object:Gem::Requirement
66
64
  requirements:
67
65
  - - "~>"
68
66
  - !ruby/object:Gem::Version
69
67
  version: '10.0'
68
+ prerelease: false
69
+ type: :development
70
70
  description: Dump records to vertica
71
71
  email:
72
72
  - sonots@gmail.com
@@ -97,7 +97,7 @@ homepage: https://github.com/sonots/embulk-output-vertica
97
97
  licenses:
98
98
  - MIT
99
99
  metadata: {}
100
- post_install_message:
100
+ post_install_message:
101
101
  rdoc_options: []
102
102
  require_paths:
103
103
  - lib
@@ -112,9 +112,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  requirements: []
115
- rubyforge_project:
116
- rubygems_version: 2.5.1
117
- signing_key:
115
+ rubyforge_project:
116
+ rubygems_version: 2.4.8
117
+ signing_key:
118
118
  specification_version: 4
119
119
  summary: Vertica output plugin for Embulk
120
120
  test_files: []