embulk-output-vertica 0.5.8 → 0.5.9

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: a5c852962bbea4e096164da3d4e1686a2c4dddda
4
- data.tar.gz: db0801b7d7645f8a93442339e91427ea80c8fac9
3
+ metadata.gz: 43ce7f3d95fb038f1ed88f0d6439971ca7fcaae3
4
+ data.tar.gz: ba0bbaf232f3e38694ef9671b677998e2773c6a1
5
5
  SHA512:
6
- metadata.gz: 74423ccdc71170c85ead4e7b5181d4308f6c7ab391de32fcd533547cc4729aee8aaefb57792954d9680179ec0a7b29e7728fc54d9745139b9fa680aa8b2ff1fd
7
- data.tar.gz: fbdb7aa14a69cb04fbbce927ed8da214daf099b1043c9f42faba65574058e1b19fee0c97625d31f6272220944cad470bebfb1001774a5bf6fa36d6b0b9ec331b
6
+ metadata.gz: 25060fb55332281e7f54a88cdfb6d91d90287dbc3250722e4ca9b56c935bb728e1269e6d954d91e82822dcbfb5ecb4e5ed29833d9ae9deb04f1449a5e0ae4c2d
7
+ data.tar.gz: 6826c93e0abd8cbb0664145fbbb19899d754e8e67948b1ac9e151bca324235f66d5ab995c8ed209ca138e3e78d78be9c08574bbac5c03fe32f87d74715f22ec6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # 0.5.9 (2016/01/26)
2
+
3
+ Enhancements:
4
+
5
+ * log speed (rows/sec) of progress
6
+
7
+ Trivial changes:
8
+
9
+ * Use ::Jvertica.quote to quote resource_pool
10
+ * change log_level of push / pop finish
11
+ * change log_level of select result from debug to trace
12
+
1
13
  # 0.5.8 (2016/01/24)
2
14
 
3
15
  Enhancements:
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "embulk-output-vertica"
3
- spec.version = "0.5.8"
3
+ spec.version = "0.5.9"
4
4
  spec.authors = ["eiji.sekiya", "Naotoshi Seo"]
5
5
  spec.email = ["eiji.sekiya.0326@gmail.com", "sonots@gmail.com"]
6
6
  spec.summary = "Vertica output plugin for Embulk"
@@ -109,7 +109,7 @@ module Embulk
109
109
  connect(task) do |jv|
110
110
  # clean up the temp table
111
111
  query(jv, %[DROP TABLE IF EXISTS #{quoted_schema}.#{quoted_temp_table}])
112
- Embulk.logger.debug { "embulk-output-vertica: select result\n#{query(jv, %[SELECT * FROM #{quoted_schema}.#{quoted_table} LIMIT 10]).map {|row| row.to_h }.join("\n") rescue nil}" }
112
+ Embulk.logger.trace { "embulk-output-vertica: select result\n#{query(jv, %[SELECT * FROM #{quoted_schema}.#{quoted_table} LIMIT 10]).map {|row| row.to_h }.join("\n") rescue nil}" }
113
113
  end
114
114
  end
115
115
  # this is for -o next_config option, add some paramters for next time execution if wants
@@ -154,8 +154,8 @@ module Embulk
154
154
  database: task['database'],
155
155
  })
156
156
 
157
- if task['resource_pool']
158
- query(jv, "SET SESSION RESOURCE_POOL = '#{task['resource_pool']}'")
157
+ if resource_pool = task['resource_pool']
158
+ query(jv, "SET SESSION RESOURCE_POOL = #{::Jvertica.quote(resource_pool)}")
159
159
  end
160
160
 
161
161
  if block_given?
@@ -54,6 +54,7 @@ module Embulk
54
54
  @outer_thread = Thread.current
55
55
  @thread_active = false
56
56
  @progress_log_timer = Time.now
57
+ @previous_num_input_rows = 0
57
58
 
58
59
  case task['compress']
59
60
  when 'GZIP'
@@ -92,13 +93,20 @@ module Embulk
92
93
  buf << record << "\n"
93
94
  @num_input_rows += 1
94
95
  end
96
+ sleep 10
95
97
  now = Time.now
96
98
  if @progress_log_timer < now - 10 # once in 10 seconds
99
+ speed = ((@num_input_rows - @previous_num_input_rows) / (now - @progress_log_timer).to_f).round(1)
97
100
  @progress_log_timer = now
98
- Embulk.logger.info { "embulk-output-vertica: num_input_rows #{@num_input_rows}" }
101
+ @previous_num_input_rows = @num_input_rows
102
+ Embulk.logger.info { "embulk-output-vertica: num_input_rows #{num_format(@num_input_rows)} (#{num_format(speed)} rows/sec)" }
99
103
  end
100
104
  end
101
105
 
106
+ def num_format(number)
107
+ number.to_s.gsub(/(\d)(?=(\d{3})+(?!\d))/, '\1,')
108
+ end
109
+
102
110
  def run
103
111
  Embulk.logger.debug { "embulk-output-vertica: thread started" }
104
112
  Vertica.connect(@task) do |jv|
@@ -107,7 +115,7 @@ module Embulk
107
115
  num_output_rows, rejects = copy(jv, copy_sql) do |stdin|
108
116
  while json_page = @queue.pop
109
117
  if json_page == 'finish'
110
- Embulk.logger.trace { "embulk-output-vertica: popped finish" }
118
+ Embulk.logger.debug { "embulk-output-vertica: popped finish" }
111
119
  break
112
120
  end
113
121
  Embulk.logger.trace { "embulk-output-vertica: dequeued" }
@@ -155,8 +163,8 @@ module Embulk
155
163
  def commit
156
164
  @thread_active = false
157
165
  if @thread.alive?
166
+ Embulk.logger.debug { "embulk-output-vertica: push finish" }
158
167
  @queue.push('finish')
159
- Embulk.logger.trace { "embulk-output-vertica: pushed finish" }
160
168
  Thread.pass
161
169
  @thread.join
162
170
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-output-vertica
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - eiji.sekiya
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-23 00:00:00.000000000 Z
12
+ date: 2016-01-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jvertica