embulk-input-redshift 0.10.0 → 0.10.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
  SHA256:
3
- metadata.gz: 9c54964bbf0155adb050eeb74010c7623121ed3c01e4cd61a7bb61924c9fdcd2
4
- data.tar.gz: 6a8cda4203c69b5c5ff3045c75e833c06111cfacb419c257676c4fdc7f67fb4b
3
+ metadata.gz: d90c302f2b33a493831a26dcb2b4e0708a74d8678b592150575f242653404006
4
+ data.tar.gz: 5d5940e37cfced39c520bf65f0818dd83df69bccf18055359897672d2b84f312
5
5
  SHA512:
6
- metadata.gz: 4882f793a635c81330746bab77fec9467cd3c250fd6c64107f2d0826cff2a7a37e31912dbeb9fcdac4d5dcf32cfcb64ad83b26b80deb72693361bdd5f8ed29fa
7
- data.tar.gz: 518f1f94e44b5606251afe4616bf964b90b5e6be83760668c9e2237f344922de8f40e495dfffd663412e1232011d89f16323d079a5dfa36d37b3762786d88014
6
+ metadata.gz: 5e699117348eaffd2f0186af536fac8972c23c8866536b15ad683a196b1f2b5204b4c7e7f87e9601cce83bc3e2972452f6606d5cd4e5903681b5fd18153bae68
7
+ data.tar.gz: f4a057665b092d6fadbe533d92ea12b71ac654302b5be14050ecb0ec72c25da16d3c2d5e9e2c36255751fbc81c41fff2351f888e547e61bef6edf4d7b4febd78
data/README.md CHANGED
@@ -30,7 +30,7 @@ Redshift input plugin for Embulk loads records from Redshift.
30
30
  - **where**: WHERE condition to filter the rows (string, default: no-condition)
31
31
  - **order_by**: expression of ORDER BY to sort rows (e.g. `created_at DESC, id ASC`) (string, default: not sorted)
32
32
  - **incremental**: if true, enables incremental loading. See next section for details (boolean, default: false)
33
- - **incremental_columns**: column names for incremental loading (array of strings, default: use primary keys)
33
+ - **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.
34
34
  - **last_record**: values of the last record for incremental loading (array of objects, default: load all records)
35
35
  - **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`)
36
36
  - **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.
@@ -63,13 +63,13 @@ ORDER BY updated_at, id
63
63
 
64
64
  When bulk data loading finishes successfully, it outputs `last_record: ` paramater as config-diff so that next execution uses it.
65
65
 
66
- 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,
66
+ 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,
67
67
 
68
68
  ```
69
69
  SELECT * FROM (
70
70
  ...original query is here...
71
71
  )
72
- WHERE updated_at > '2017-01-01 00:32:12' OR (updated_at = '2017-01-01 00:32:12' AND id > 5291)
72
+ WHERE updated_at > '2017-01-01 00:32:12.487659' OR (updated_at = '2017-01-01 00:32:12.487659' AND id > 5291)
73
73
  ORDER BY updated_at, id
74
74
  ```
75
75
 
@@ -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: int_load
2
+ incremental: true
3
+ incremental_columns: [name]
@@ -0,0 +1,4 @@
1
+ table: int_load
2
+ last_record: ['A4']
3
+ incremental: true
4
+ incremental_columns: [name]
@@ -0,0 +1,6 @@
1
+
2
+ insert into int_load (name, note) values
3
+ ('A0', 'more_skip'),
4
+ ('A4', 'more_skip'),
5
+ ('A9', 'more_load'),
6
+ ('A5', 'more_load');
@@ -0,0 +1,12 @@
1
+ drop table if exists int_load;
2
+
3
+ create table int_load (
4
+ name char(2) not null,
5
+ note text
6
+ );
7
+
8
+ insert into int_load (name, note) values
9
+ ('A3', 'first'),
10
+ ('A4', 'first'),
11
+ ('A2', 'first'),
12
+ ('A1', 'first');
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-redshift
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,15 +19,23 @@ 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
24
- - classpath/embulk-input-redshift-0.10.0.jar
22
+ - classpath/embulk-input-jdbc-0.10.1.jar
23
+ - classpath/embulk-input-postgresql-0.10.1.jar
24
+ - classpath/embulk-input-redshift-0.10.1.jar
25
25
  - classpath/postgresql-9.4-1205-jdbc41.jar
26
26
  - lib/embulk/input/redshift.rb
27
27
  - src/main/java/org/embulk/input/RedshiftInputPlugin.java
28
28
  - src/main/java/org/embulk/input/redshift/getter/RedshiftColumnGetterFactory.java
29
29
  - src/test/java/org/embulk/input/redshift/IncrementalTest.java
30
30
  - src/test/java/org/embulk/input/redshift/RedshiftTests.java
31
+ - src/test/resources/org/embulk/input/redshift/test/expect/incremental/char/config_1.yml
32
+ - src/test/resources/org/embulk/input/redshift/test/expect/incremental/char/config_2.yml
33
+ - src/test/resources/org/embulk/input/redshift/test/expect/incremental/char/expected_1.csv
34
+ - src/test/resources/org/embulk/input/redshift/test/expect/incremental/char/expected_1.diff
35
+ - src/test/resources/org/embulk/input/redshift/test/expect/incremental/char/expected_2.csv
36
+ - src/test/resources/org/embulk/input/redshift/test/expect/incremental/char/expected_2.diff
37
+ - src/test/resources/org/embulk/input/redshift/test/expect/incremental/char/insert_more.sql
38
+ - src/test/resources/org/embulk/input/redshift/test/expect/incremental/char/setup.sql
31
39
  - src/test/resources/org/embulk/input/redshift/test/expect/incremental/int/config_1.yml
32
40
  - src/test/resources/org/embulk/input/redshift/test/expect/incremental/int/config_2.yml
33
41
  - src/test/resources/org/embulk/input/redshift/test/expect/incremental/int/expected_1.csv