embulk-input-postgresql 0.10.0 → 0.10.1

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
  SHA256:
3
- metadata.gz: 0f1e541f85bd0a140c29d03b8ea6faa9e19f57615a6a247bf56e29157674c812
4
- data.tar.gz: 26f6756d61b5cd06e26246571dfa8993c5cdaba23e0bc3c1e9a5c2f7585e2810
3
+ metadata.gz: 45d7ceaf1d590b58cf1cbfbc244683d21471daf2d81c1fef38ed4a816949f06d
4
+ data.tar.gz: d83b6752173718098551891444919a73034680b9961cc3fd25bd3de79d6b67a5
5
5
  SHA512:
6
- metadata.gz: b519fb0d9d2404887bc310c9d82abb911d4aa0f76b22ea13e2465ee68fca6ac078278e73706b949de589d4f6e22bdd4fb0ccb5ace0be603bc7601015da59f8d7
7
- data.tar.gz: 36608aff9877cf1e838642742570ddb9d31fd2007d1c7bece49186ff1e229cc68d00873733afab7c2734769492a3abbca1d973472d7e4b87fca65174d4bc0d32
6
+ metadata.gz: 0c388f481f1b58c12a011c5bba7f88574cb77bf54b8196b582bcabfab3a12a4d996b894ac62a69cbd0f88ce16a10b887f8dc03c89ed6cb8c70a38c3b2b8e1200
7
+ data.tar.gz: 9f34796f9acfd2be545f790e005e6d058fbccd9d5e630e4a75ea8824aef17c4fab9c2bf0280e7b9a906b5ba98e85c283528b45231d4d3bf291cb5aad241f5963
data/README.md CHANGED
@@ -31,7 +31,7 @@ PostgreSQL input plugin for Embulk loads records from PostgreSQL.
31
31
  - **where**: WHERE condition to filter the rows (string, default: no-condition)
32
32
  - **order_by**: expression of ORDER BY to sort rows (e.g. `created_at DESC, id ASC`) (string, default: not sorted)
33
33
  - **incremental**: if true, enables incremental loading. See next section for details (boolean, default: false)
34
- - **incremental_columns**: column names for incremental loading (array of strings, default: use primary keys)
34
+ - **incremental_columns**: column names for incremental loading (array of strings, default: use primary keys). Columns of integer types, string types, `timestamp` and `timestamptz` are supported.
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
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.
@@ -98,13 +98,13 @@ ORDER BY updated_at, id
98
98
 
99
99
  When bulk data loading finishes successfully, it outputs `last_record: ` paramater as config-diff so that next execution uses it.
100
100
 
101
- At the next execution, when `last_record: ` is also set, this plugin generates additional WHERE conditions to load records larger than the last record. For example, if `last_record: ["2017-01-01 00:32:12", 5291]` is set,
101
+ At the next execution, when `last_record: ` is also set, this plugin generates additional WHERE conditions to load records larger than the last record. For example, if `last_record: ["2017-01-01T00:32:12.487659", 5291]` is set,
102
102
 
103
103
  ```
104
104
  SELECT * FROM (
105
105
  ...original query is here...
106
106
  )
107
- WHERE updated_at > '2017-01-01 00:32:12' OR (updated_at = '2017-01-01 00:32:12' AND id > 5291)
107
+ WHERE updated_at > '2017-01-01 00:32:12.487659' OR (updated_at = '2017-01-01 00:32:12.487659' AND id > 5291)
108
108
  ORDER BY updated_at, id
109
109
  ```
110
110
 
@@ -77,6 +77,38 @@ public class IncrementalTest
77
77
  is((ConfigDiff) loadYamlResource(embulk, "int/expected_2.diff")));
78
78
  }
79
79
 
80
+ @Test
81
+ public void simpleChar() throws Exception
82
+ {
83
+ // setup first rows
84
+ execute(readResource("char/setup.sql"));
85
+
86
+ Path out1 = embulk.createTempFile("csv");
87
+ RunResult result1 = embulk.runInput(
88
+ baseConfig.merge(loadYamlResource(embulk, "char/config_1.yml")),
89
+ out1);
90
+ assertThat(
91
+ readSortedFile(out1),
92
+ is(readResource("char/expected_1.csv")));
93
+ assertThat(
94
+ result1.getConfigDiff(),
95
+ is((ConfigDiff) loadYamlResource(embulk, "char/expected_1.diff")));
96
+
97
+ // insert more rows
98
+ execute(readResource("char/insert_more.sql"));
99
+
100
+ Path out2 = embulk.createTempFile("csv");
101
+ RunResult result2 = embulk.runInput(
102
+ baseConfig.merge(loadYamlResource(embulk, "char/config_2.yml")),
103
+ out2);
104
+ assertThat(
105
+ readSortedFile(out2),
106
+ is(readResource("char/expected_2.csv")));
107
+ assertThat(
108
+ result2.getConfigDiff(),
109
+ is((ConfigDiff) loadYamlResource(embulk, "char/expected_2.diff")));
110
+ }
111
+
80
112
  @Test
81
113
  public void simpleTimestampWithoutTimeZone() throws Exception
82
114
  {
@@ -0,0 +1,3 @@
1
+ table: char_load
2
+ incremental: true
3
+ incremental_columns: [name]
@@ -0,0 +1,4 @@
1
+ table: char_load
2
+ last_record: ['A4']
3
+ incremental: true
4
+ incremental_columns: [name]
@@ -0,0 +1,7 @@
1
+
2
+ insert into char_load (name, note) values
3
+ ('A0', 'more_skip'),
4
+ ('A4', 'more_skip'),
5
+ ('A9', 'more_load'),
6
+ ('A5', 'more_load');
7
+
@@ -0,0 +1,13 @@
1
+ drop table if exists char_load;
2
+
3
+ create table char_load (
4
+ name char(2) not null,
5
+ note text
6
+ );
7
+
8
+ insert into char_load (name, note) values
9
+ ('A3', 'first'),
10
+ ('A4', 'first'),
11
+ ('A2', 'first'),
12
+ ('A1', 'first');
13
+
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.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-23 00:00:00.000000000 Z
11
+ date: 2019-09-06 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.10.0.jar
23
- - classpath/embulk-input-postgresql-0.10.0.jar
22
+ - classpath/embulk-input-jdbc-0.10.1.jar
23
+ - classpath/embulk-input-postgresql-0.10.1.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
@@ -43,6 +43,14 @@ files:
43
43
  - src/test/resources/org/embulk/input/postgresql/test/expect/hstore/expected_json.csv
44
44
  - src/test/resources/org/embulk/input/postgresql/test/expect/hstore/expected_string.csv
45
45
  - src/test/resources/org/embulk/input/postgresql/test/expect/hstore/setup.sql
46
+ - src/test/resources/org/embulk/input/postgresql/test/expect/incremental/char/config_1.yml
47
+ - src/test/resources/org/embulk/input/postgresql/test/expect/incremental/char/config_2.yml
48
+ - src/test/resources/org/embulk/input/postgresql/test/expect/incremental/char/expected_1.csv
49
+ - src/test/resources/org/embulk/input/postgresql/test/expect/incremental/char/expected_1.diff
50
+ - src/test/resources/org/embulk/input/postgresql/test/expect/incremental/char/expected_2.csv
51
+ - src/test/resources/org/embulk/input/postgresql/test/expect/incremental/char/expected_2.diff
52
+ - src/test/resources/org/embulk/input/postgresql/test/expect/incremental/char/insert_more.sql
53
+ - src/test/resources/org/embulk/input/postgresql/test/expect/incremental/char/setup.sql
46
54
  - src/test/resources/org/embulk/input/postgresql/test/expect/incremental/int/config_1.yml
47
55
  - src/test/resources/org/embulk/input/postgresql/test/expect/incremental/int/config_2.yml
48
56
  - src/test/resources/org/embulk/input/postgresql/test/expect/incremental/int/expected_1.csv