embulk-output-vertica 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/embulk-output-vertica.gemspec +1 -1
- data/lib/embulk/output/vertica.rb +14 -8
- 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: fe435fb50a129cc904e31d2e87d9119804acf854
|
4
|
+
data.tar.gz: 23458272c05c2b660033b4ec893f18913080fb6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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'
|
14
|
-
'port'
|
15
|
-
'username'
|
16
|
-
'password'
|
17
|
-
'database'
|
18
|
-
'schema'
|
19
|
-
'table'
|
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"
|