embulk-input-postgresql 0.9.3 → 0.10.0

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
- SHA1:
3
- metadata.gz: edb5cbc6680e6fdd62506d5274f43ae0fa95e89d
4
- data.tar.gz: a961032ae6f7add861fcd88760fc8bbe9f09fe05
2
+ SHA256:
3
+ metadata.gz: 0f1e541f85bd0a140c29d03b8ea6faa9e19f57615a6a247bf56e29157674c812
4
+ data.tar.gz: 26f6756d61b5cd06e26246571dfa8993c5cdaba23e0bc3c1e9a5c2f7585e2810
5
5
  SHA512:
6
- metadata.gz: ece1c87b6a0b05919ba2054cdcdb8a10f59c3b4e4d9b6c6a1fb689f3964bfae1f013d5d0e17d8a453f1c49f7fe6a80218bfdb0bc2c19fd976a388cc517fb62cf
7
- data.tar.gz: b0a055403e5a383316f4a39caee43fa24fd70207aa24a950779dfe3f08182e2d95e86a635057cc561b890626fd5d099603120fad0ae5bd308b80f3754c3c2e0b
6
+ metadata.gz: b519fb0d9d2404887bc310c9d82abb911d4aa0f76b22ea13e2465ee68fca6ac078278e73706b949de589d4f6e22bdd4fb0ccb5ace0be603bc7601015da59f8d7
7
+ data.tar.gz: 36608aff9877cf1e838642742570ddb9d31fd2007d1c7bece49186ff1e229cc68d00873733afab7c2734769492a3abbca1d973472d7e4b87fca65174d4bc0d32
data/README.md CHANGED
@@ -34,7 +34,8 @@ PostgreSQL input plugin for Embulk loads records from PostgreSQL.
34
34
  - **incremental_columns**: column names for incremental loading (array of strings, default: use primary keys)
35
35
  - **last_record**: values of the last record for incremental loading (array of objects, default: load all records)
36
36
  - **default_timezone**: If the sql type of a column is `date`/`time`/`datetime` and the embulk type is `string`, column values are formatted int this default_timezone. You can overwrite timezone for each columns using column_options option. (string, default: `UTC`)
37
- - **column_options**: advanced: a key-value pairs where key is a column name and value is options for the column.
37
+ - **default_column_options**: advanced: column_options for each JDBC type as default. key-value pairs where key is a JDBC type (e.g. 'DATE', 'BIGINT') and value is same as column_options's value.
38
+ - **column_options**: advanced: key-value pairs where key is a column name and value is options for the column.
38
39
  - **value_type**: embulk get values from database as this value_type. Typically, the value_type determines `getXXX` method of `java.sql.PreparedStatement`.
39
40
  (string, default: depends on the sql type of the column. Available values options are: `long`, `double`, `float`, `decimal`, `boolean`, `string`, `json`, `date`, `time`, `timestamp`, `array`)
40
41
  See below for `hstore` column.
@@ -45,6 +46,8 @@ PostgreSQL input plugin for Embulk loads records from PostgreSQL.
45
46
  - **timestamp_format**: If the sql type of the column is `date`/`time`/`datetime` and the embulk type is `string`, column values are formatted by this timestamp_format. And if the embulk type is `timestamp`, this timestamp_format may be used in the output plugin. For example, stdout plugin use the timestamp_format, but *csv formatter plugin doesn't use*. (string, default : `%Y-%m-%d` for `date`, `%H:%M:%S` for `time`, `%Y-%m-%d %H:%M:%S` for `timestamp`)
46
47
  - **timezone**: If the sql type of the column is `date`/`time`/`datetime` and the embulk type is `string`, column values are formatted in this timezone.
47
48
  (string, value of default_timezone option is used by default)
49
+ - **before_setup**: if set, this SQL will be executed before setup. You can prepare table for input by this option.
50
+ - **before_select**: if set, this SQL will be executed before the SELECT query in the same transaction.
48
51
  - **after_select**: if set, this SQL will be executed after the SELECT query in the same transaction.
49
52
 
50
53
  ### hstore column support
@@ -113,7 +116,7 @@ Then, it updates `last_record: ` so that next execution uses the updated last_re
113
116
  CREATE INDEX embulk_incremental_loading_index ON table (updated_at, id);
114
117
  ```
115
118
 
116
- Recommended usage is to leave `incremental_columns` unset and let this plugin automatically finds an auto-increment (serial / bigserial) primary key. Currently, only strings and integers are supported as incremental_columns.
119
+ Recommended usage is to leave `incremental_columns` unset and let this plugin automatically finds an auto-increment (serial / bigserial) primary key. Currently, only strings, integers, TIMESTAMP and TIMESTAMPTZ are supported as incremental_columns.
117
120
 
118
121
  ### Use incremental loading with raw query
119
122
 
@@ -200,6 +203,9 @@ in:
200
203
  table: "my_table"
201
204
  select: "col1, col2, col3"
202
205
  where: "col4 != 'a'"
206
+ default_column_options:
207
+ TIMESTAMP: { type: string, timestamp_format: "%Y/%m/%d %H:%M:%S", timezone: "+0900"}
208
+ BIGINT: { type: string }
203
209
  column_options:
204
210
  col1: {type: long}
205
211
  col3: {type: string, timestamp_format: "%Y/%m/%d", timezone: "+0900"}
data/build.gradle CHANGED
@@ -4,5 +4,5 @@ dependencies {
4
4
  compile 'org.postgresql:postgresql:9.4-1205-jdbc41'
5
5
  defaultJdbcDriver 'org.postgresql:postgresql:9.4-1205-jdbc41'
6
6
 
7
- testCompile 'org.embulk:embulk-standards:0.8.15'
7
+ testCompile 'org.embulk:embulk-standards:0.9.12'
8
8
  }
@@ -155,7 +155,9 @@ public class ArrayColumnGetter
155
155
  }
156
156
  builder.append(",");
157
157
  }
158
- builder.deleteCharAt(builder.length() - 1);
158
+ if (values.length > 0) {
159
+ builder.deleteCharAt(builder.length() - 1);
160
+ }
159
161
  builder.append("}");
160
162
  }
161
163
 
@@ -1,3 +1,4 @@
1
1
  "[1000,2000,3000,4000]","[[""red"",""green""],[""blue"",""cyan""]]",[[[true]]],[1.23456789E9]
2
2
  "[5000,6000,7000,8000]","[[""yellow"",""magenta""],[""purple"",""light,dark""]]","[[[true,true],[false,false]],[[true,false],[false,true]]]",[1.2345678901234567E19]
3
3
  [1000],"[[""\"""",""{\\}"",""{a,b}""]]",[true],[1.2345678901234567E19]
4
+ [],[],[],[]
@@ -1,3 +1,4 @@
1
1
  "{1000,2000,3000,4000}","{{red,green},{blue,cyan}}",{{{t}}},{1234567890}
2
2
  "{5000,6000,7000,8000}","{{yellow,magenta},{purple,""light,dark""}}","{{{t,t},{f,f}},{{t,f},{f,t}}}",{12345678901234567890}
3
3
  {1000},"{{""\"""",""{\\}"",""{a,b}""}}",{t},{12345678901234567890.1234567890}
4
+ {},{},{},{}
@@ -12,3 +12,5 @@ insert into input_array (c1, c2, c3, c4) values ('{1000, 2000, 3000, 4000}', '{{
12
12
  insert into input_array (c1, c2, c3, c4) values ('{5000, 6000, 7000, 8000}', '{{"yellow", "magenta"}, {"purple", "light,dark"}}', '{{{t,t},{f,f}},{{t,f},{f,t}}}', '{12345678901234567890}');
13
13
 
14
14
  insert into input_array (c1, c2, c3, c4) values ('{1000}', '{{"\"", "{\\}", "{a,b}"}}', '{true}', '{12345678901234567890.1234567890}');
15
+
16
+ insert into input_array (c1, c2, c3, c4) values ('{}', '{}', '{}', '{}');
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-postgresql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-10 00:00:00.000000000 Z
11
+ date: 2019-05-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Selects records from a table.
14
14
  email:
@@ -19,8 +19,8 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - README.md
21
21
  - build.gradle
22
- - classpath/embulk-input-jdbc-0.9.3.jar
23
- - classpath/embulk-input-postgresql-0.9.3.jar
22
+ - classpath/embulk-input-jdbc-0.10.0.jar
23
+ - classpath/embulk-input-postgresql-0.10.0.jar
24
24
  - default_jdbc_driver/postgresql-9.4-1205-jdbc41.jar
25
25
  - lib/embulk/input/postgresql.rb
26
26
  - src/main/java/org/embulk/input/PostgreSQLInputPlugin.java
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  requirements: []
106
106
  rubyforge_project:
107
- rubygems_version: 2.4.8
107
+ rubygems_version: 2.6.13
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: JDBC input plugin for Embulk
Binary file