embulk-output-vertica 0.1.0 → 0.1.1

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: 7b5979942b9ed3ae9f640b1150f9a05679e2f4ce
4
- data.tar.gz: 0af6db714dc9fa90258c6f3ff5587847037e43ce
3
+ metadata.gz: fe435fb50a129cc904e31d2e87d9119804acf854
4
+ data.tar.gz: 23458272c05c2b660033b4ec893f18913080fb6e
5
5
  SHA512:
6
- metadata.gz: eb62e8c19e59aa31f71659db45a5c4a6c840540b6b074483e79f3ff9f844ace4d283a351877c4cbfaadce82fda3dc07425704e2101fdb16ff9e6c3988bfa5d25
7
- data.tar.gz: e559a967086ae51ccd02f0dd95c8acb4f362c410edae12ebd972f6e17c5bd22a7edc5ba278e54b48e073643f331df0d04b06d05bb4b57f1f4bb1bfef96027cef
6
+ metadata.gz: 92258f1615b0bb2157a67840e782d141c37752ae2dbb6bf8ed272b958375727a740c5ca902162b66c691df42e4356797499430ce02fb3bbe4d1b5ee7e95e56b2
7
+ data.tar.gz: 170a6dd3a87987a25d9977fad7674330be58a20bcf89002a0060a16db96c587ce7c978cdb81c3063226c35778bf12ab7fc14834df52d60d926bfaa97175bc529
data/README.md CHANGED
@@ -16,6 +16,7 @@
16
16
  - **database**: database name (string, default: vdb)
17
17
  - **schema**: schema name (string, default: public)
18
18
  - **table**: table name (string, required)
19
+ - **copy_mode**: specifies how data is loaded into the database. (`AUTO`, `DIRECT`, or `TRICKLE`. default: AUTO)
19
20
 
20
21
  ## Example
21
22
 
@@ -28,6 +29,7 @@ out:
28
29
  database: vdb
29
30
  schema: sandbox
30
31
  table: embulk_test
32
+ copy_mode: DIRECT
31
33
  ```
32
34
 
33
35
 
@@ -38,7 +40,7 @@ Run example:
38
40
  ```
39
41
  $ embulk gem install embulk-input-random
40
42
  $ embulk gem install jvertica
41
- $ embulk run -I lib example.yml
43
+ $ embulk run -I lib -l debug example.yml
42
44
  ```
43
45
 
44
46
  Release gem:
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "embulk-output-vertica"
3
- spec.version = "0.1.0"
3
+ spec.version = "0.1.1"
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"
@@ -10,15 +10,20 @@ module Embulk
10
10
 
11
11
  def self.transaction(config, schema, processor_count, &control)
12
12
  task = {
13
- 'host' => config.param('host', :string, :default => 'localhost'),
14
- 'port' => config.param('port', :integer, :default => 5433),
15
- 'username' => config.param('username', :string),
16
- 'password' => config.param('password', :string, :default => ''),
17
- 'database' => config.param('database', :string, :default => 'vdb'),
18
- 'schema' => config.param('schema', :string, :default => 'public'),
19
- 'table' => config.param('table', :string),
13
+ 'host' => config.param('host', :string, :default => 'localhost'),
14
+ 'port' => config.param('port', :integer, :default => 5433),
15
+ 'username' => config.param('username', :string),
16
+ 'password' => config.param('password', :string, :default => ''),
17
+ 'database' => config.param('database', :string, :default => 'vdb'),
18
+ 'schema' => config.param('schema', :string, :default => 'public'),
19
+ 'table' => config.param('table', :string),
20
+ 'copy_mode' => config.param('copy_mode', :string, :default => 'AUTO'),
20
21
  }
21
22
 
23
+ unless %w[AUTO DIRECT TRICKLE].include?(task['copy_mode'].upcase)
24
+ raise ConfigError, "`copy_mode` must be one of AUTO, DIRECT, TRICKLE"
25
+ end
26
+
22
27
  now = Time.now
23
28
  unique_name = "%08x%08x" % [now.tv_sec, now.tv_nsec]
24
29
  task['temp_table'] = "#{task['table']}_LOAD_TEMP_#{unique_name}"
@@ -96,7 +101,8 @@ module Embulk
96
101
  end
97
102
 
98
103
  def add(page)
99
- sql = "COPY #{@task['schema']}.#{@task['temp_table']} FROM STDIN DELIMITER ',' NO COMMIT"
104
+ sql = "COPY #{@task['schema']}.#{@task['temp_table']} FROM STDIN DELIMITER ',' #{@task['copy_mode']} NO COMMIT"
105
+ Embulk.logger.debug sql
100
106
  @jv.copy(sql) do |stdin|
101
107
  page.each_with_index do |record, idx|
102
108
  stdin << record.map {|v| ::Jvertica.quote(v) }.join(",") << "\n"
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.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - eiji.sekiya