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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/embulk-output-vertica.gemspec +1 -1
- data/lib/embulk/output/vertica.rb +29 -1
- data/lib/embulk/output/vertica/output_thread.rb +1 -0
- metadata +23 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a242b2cf1e51a66b6437732cbe452462e4c8cf2
|
4
|
+
data.tar.gz: c246522c98e21f209d91b68eb822963b85b72f4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5b433c8a06ad2c3d0be6fc90d9bc31e0e4a919bd292e7a994d9dace14587ee5cbcc09f05c5760d3f0f02c4504d6ee94bc3fd39ad7c453d7acadb1a93967ae59
|
7
|
+
data.tar.gz: 1a3f92018cbcfa04ed2e5cd18a07459ec2e2288398bc5e6422c3aa6d6b842be68b32aa4290135f307d22be7cd4f8d740d72649adeb7580961c36f6bd2aa04c33
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "embulk-output-vertica"
|
3
|
-
spec.version = "0.7.
|
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 =
|
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}")
|
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.
|
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-
|
12
|
+
date: 2016-05-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jvertica
|
16
|
-
|
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
|
-
|
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
|
-
|
30
|
+
version_requirements: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
|
-
|
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
|
-
|
44
|
+
version_requirements: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '1.7'
|
49
|
-
|
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
|
-
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '10.0'
|
63
|
-
|
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.
|
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: []
|