embulk-input-oracle 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: 8a630b0262f22d7facc47e39c38218ae2c6317c48e83bc8701b52380fb99c8ce
4
- data.tar.gz: ee05d5351375af8dbd76313647ad3d47334cc1ae2574e2dfab5925274f45a151
3
+ metadata.gz: 7fd45290a62e5fab8144f58f1c66761f3b9fac00ebbaa9b1f68d34d7a2a630fc
4
+ data.tar.gz: fb2620bbb65061a8ebe163ec28d3c668f1a2fe36196eb2f1640576ca88c83610
5
5
  SHA512:
6
- metadata.gz: 94f2855054a9b4564fa1cf7da9b47b072ca623848ba598e4095200b786b75beb282083f2448526d139937f94ed7a41b326c87bf2ad235543910c8db0b1077f02
7
- data.tar.gz: 9b23bf271dcbfc892b9d81bc6c64d45890717ecb95174fa20c1888daf2f598173a3fde391840a261487d97a92b415fb532709bbfc63ca0dc2a830c3cca8f298b
6
+ metadata.gz: e4d46471e9fb17fc8e755d675e9cb91473f18cdff52c37e9a1c61303acfbb5340cbd67f488ccd76067a14b38b6f35db85144ceea3396e5a4617861e59da1c99b
7
+ data.tar.gz: 07e0b3c0941d1990ce3aa5d45eaf21bf33c17473687f17b2d73358c6ccbda69b3b3c51e7543c43cd3acb34154baad3e7da9bd2fed3de08c856e4ec5e5cd30604
data/README.md CHANGED
@@ -32,7 +32,8 @@ Oracle input plugin for Embulk loads records from Oracle.
32
32
  - **socket_timeout**: timeout for socket read operations. (integer (seconds), default: 1800)
33
33
  - **options**: extra JDBC properties (hash, default: {})
34
34
  - **incremental**: if true, enables incremental loading. See next section for details (boolean, default: false)
35
- - **incremental_columns**: column names for incremental loading (array of strings, default: use primary keys)
35
+ - **incremental_columns**: column names for incremental loading (array of strings, default: use primary keys). Columns of integer types, string types, `date` and `timestamp` are supported.
36
+ NOTE: Because Oracle `NUMBER` type is mapped to embulk `double` type by default, you should explicitly map it to embulk `long` type by `column_options` in order to use it as incremental column.
36
37
  - **last_record**: values of the last record for incremental loading (array of objects, default: load all records)
37
38
  - **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`)
38
39
  - **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.
@@ -65,13 +66,13 @@ ORDER BY updated_at, id
65
66
 
66
67
  When bulk data loading finishes successfully, it outputs `last_record: ` paramater as config-diff so that next execution uses it.
67
68
 
68
- 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,
69
+ 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,
69
70
 
70
71
  ```
71
72
  SELECT * FROM (
72
73
  ...original query is here...
73
74
  )
74
- WHERE updated_at > '2017-01-01 00:32:12' OR (updated_at = '2017-01-01 00:32:12' AND id > 5291)
75
+ WHERE updated_at > '2017-01-01 00:32:12.487659' OR (updated_at = '2017-01-01 00:32:12.487659' AND id > 5291)
75
76
  ORDER BY updated_at, id
76
77
  ```
77
78
 
@@ -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(embulk, 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(embulk, 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 simpleDate() 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,6 @@
1
+ insert into char_load (name, note) values ('A0', 'more_skip');
2
+ insert into char_load (name, note) values ('A4', 'more_skip');
3
+ insert into char_load (name, note) values ('A9', 'more_load');
4
+ insert into char_load (name, note) values ('A5', 'more_load');
5
+
6
+ EXIT;
@@ -0,0 +1,13 @@
1
+ drop table char_load;
2
+
3
+ create table char_load (
4
+ name CHAR(2) not null,
5
+ note VARCHAR2(10)
6
+ );
7
+
8
+ insert into char_load (name, note) values ('A3', 'first');
9
+ insert into char_load (name, note) values ('A4', 'first');
10
+ insert into char_load (name, note) values ('A2', 'first');
11
+ insert into char_load (name, note) values ('A1', 'first');
12
+
13
+ EXIT;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-oracle
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-oracle-0.10.0.jar
22
+ - classpath/embulk-input-jdbc-0.10.1.jar
23
+ - classpath/embulk-input-oracle-0.10.1.jar
24
24
  - lib/embulk/input/oracle.rb
25
25
  - src/main/java/org/embulk/input/OracleInputPlugin.java
26
26
  - src/main/java/org/embulk/input/oracle/OracleInputConnection.java
@@ -48,6 +48,14 @@ files:
48
48
  - src/test/resources/org/embulk/input/oracle/test/expect/basic/test_unknown_type_expected2.diff
49
49
  - src/test/resources/org/embulk/input/oracle/test/expect/basic/test_unknown_type_expected3.csv
50
50
  - src/test/resources/org/embulk/input/oracle/test/expect/basic/test_unknown_type_expected3.diff
51
+ - src/test/resources/org/embulk/input/oracle/test/expect/incremental/char/config_1.yml
52
+ - src/test/resources/org/embulk/input/oracle/test/expect/incremental/char/config_2.yml
53
+ - src/test/resources/org/embulk/input/oracle/test/expect/incremental/char/expected_1.csv
54
+ - src/test/resources/org/embulk/input/oracle/test/expect/incremental/char/expected_1.diff
55
+ - src/test/resources/org/embulk/input/oracle/test/expect/incremental/char/expected_2.csv
56
+ - src/test/resources/org/embulk/input/oracle/test/expect/incremental/char/expected_2.diff
57
+ - src/test/resources/org/embulk/input/oracle/test/expect/incremental/char/insert_more.sql
58
+ - src/test/resources/org/embulk/input/oracle/test/expect/incremental/char/setup.sql
51
59
  - src/test/resources/org/embulk/input/oracle/test/expect/incremental/date/config_1.yml
52
60
  - src/test/resources/org/embulk/input/oracle/test/expect/incremental/date/config_2.yml
53
61
  - src/test/resources/org/embulk/input/oracle/test/expect/incremental/date/expected_1.csv