embulk-output-oracle 0.4.2 → 0.4.3

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
  SHA1:
3
- metadata.gz: 1a79bcbce78533d883cb6e0a3841e8aaf188e01f
4
- data.tar.gz: 5d2db1a232285ddb3760ba920e646f510a284cce
3
+ metadata.gz: f90682291054c54ff4e0f63ab186669c440fd6a6
4
+ data.tar.gz: 96d29462e71befb92de6c15ad57d90e18a9cce30
5
5
  SHA512:
6
- metadata.gz: 7a65fe88370857e27c6a213c38efd364a33bcb02b8de88453e4bab0dfa820228c1088512394a228374efed68dbc4939a6a9901efa8eb24cfd6af137d024d0875
7
- data.tar.gz: d2e4a43b12a9632e0ea5b503cbf096c2073c32769de7d5a7f3e9d6812853f5bc99c46771f99ecaa93f078c320fa4f37989e9cb0dbe451ffafdeb530f05921746
6
+ metadata.gz: ea6510701f23a9239704394579198f2e610c1164177c2f40d24251b430a4cf0a47e2c898cde16672de95c589ef38602c00d2faef1f5ddd6bb5bfc84a35967927
7
+ data.tar.gz: 28c048cde2c7f6d71125cc1c7a691df00f7d704c36e42cbead22f1c76708f94e88e46005cf2435329c0e38b8c45d73e0e9d45a7e79965e5bec302e7afefd41a8
data/README.md CHANGED
@@ -32,11 +32,11 @@ Oracle output plugins for Embulk loads records to Oracle.
32
32
  ### Modes
33
33
 
34
34
  * **insert**:
35
- * Behavior: This mode writes rows to some intermediate tables first. If all those tasks run correctly, runs `INSERT INTO <target_table> SELECT * FROM <intermediate_table_1> UNION ALL SELECT * FROM <intermediate_table_2> UNION ALL ...` query.
35
+ * Behavior: This mode writes rows to some intermediate tables first. If all those tasks run correctly, runs `INSERT INTO <target_table> SELECT * FROM <intermediate_table_1> UNION ALL SELECT * FROM <intermediate_table_2> UNION ALL ...` query. If the target table doesn't exist, it is created automatically.
36
36
  * Transactional: Yes. This mode successfully writes all rows, or fails with writing zero rows.
37
37
  * Resumable: Yes.
38
38
  * **insert_direct**:
39
- * Behavior: This mode inserts rows to the target table directly.
39
+ * Behavior: This mode inserts rows to the target table directly. If the target table doesn't exist, it is created automatically.
40
40
  * Transactional: No. If fails, the target table could have some rows inserted.
41
41
  * Resumable: No.
42
42
  * **truncate_insert**:
@@ -44,7 +44,7 @@ Oracle output plugins for Embulk loads records to Oracle.
44
44
  * Transactional: Yes.
45
45
  * Resumable: Yes.
46
46
  * **replace**:
47
- * Behavior: Same with `insert` mode excepting that it truncates the target table right before the last `INSERT ...` query.
47
+ * Behavior: This mode writes rows to an intermediate table first. If all those tasks run correctly, drops the target table and alters the name of the intermediate table into the target table name.
48
48
  * Transactional: Yes.
49
49
  * Resumable: No.
50
50
 
@@ -155,6 +155,6 @@ For Linux (x64) (only Ubuntu Server 14.04 is tested)
155
155
  (6) Execute src/main/cpp/linux/build.sh .
156
156
 
157
157
  ***
158
- <img src="https://www.yourkit.com/images/yklogo.png" alt="YourKit"/> is used to improve performance of embulk-output-oracle.
159
- YourKit supports open source projects with its full-featured Java Profiler.
160
- YourKit, LLC is the creator of <a href="https://www.yourkit.com/java/profiler/index.jsp">YourKit Java Profiler</a> and <a href="https://www.yourkit.com/.net/profiler/index.jsp">YourKit .NET Profiler</a>, innovative and intelligent tools for profiling Java and .NET applications.
158
+ <img src="https://www.yourkit.com/images/yklogo.png" alt="YourKit"/> is used to improve performance of embulk-output-oracle.
159
+ YourKit supports open source projects with its full-featured Java Profiler.
160
+ YourKit, LLC is the creator of <a href="https://www.yourkit.com/java/profiler/index.jsp">YourKit Java Profiler</a> and <a href="https://www.yourkit.com/.net/profiler/index.jsp">YourKit .NET Profiler</a>, innovative and intelligent tools for profiling Java and .NET applications.
@@ -134,12 +134,30 @@ public class OracleOutputPluginTest
134
134
  invoke("testInsert");
135
135
  }
136
136
 
137
+ @Test
138
+ public void testInsertCreate() throws Exception
139
+ {
140
+ invoke("testInsertCreate");
141
+ }
142
+
137
143
  @Test
138
144
  public void testInsertEmpty() throws Exception
139
145
  {
140
146
  invoke("testInsertEmpty");
141
147
  }
142
148
 
149
+ @Test
150
+ public void testTruncateInsert() throws Exception
151
+ {
152
+ invoke("testTruncateInsert");
153
+ }
154
+
155
+ @Test
156
+ public void testTruncateInsertCreate() throws Exception
157
+ {
158
+ invoke("testTruncateInsertCreate");
159
+ }
160
+
143
161
  @Test
144
162
  public void testInsertDirect() throws Exception
145
163
  {
@@ -65,8 +65,8 @@ public class OracleOutputPluginTestImpl
65
65
 
66
66
  } catch (SQLException e) {
67
67
  System.err.println(e);
68
- //throw new RuntimeException("You should prepare a schema on Oracle (database = 'TESTDB', user = 'TEST_USER', password = 'test_pw').");
69
- System.err.println("Warning: prepare a schema on Oracle (database = 'TESTDB', user = 'TEST_USER', password = 'test_pw').");
68
+ //throw new RuntimeException("You should prepare a schema on Oracle (database = 'TESTDB', user = 'TEST_USER', password = 'test_pw', charset = UTF-8).");
69
+ System.err.println("Warning: prepare a schema on Oracle (database = 'TESTDB', user = 'TEST_USER', password = 'test_pw', charset = UTF-8).");
70
70
  // for example
71
71
  // CREATE USER EMBULK_USER IDENTIFIED BY "embulk_pw";
72
72
  // GRANT DBA TO EMBULK_USER;
@@ -89,6 +89,17 @@ public class OracleOutputPluginTestImpl
89
89
  assertTable(table);
90
90
  }
91
91
 
92
+ public void testInsertCreate() throws Exception
93
+ {
94
+ String table = "TEST1";
95
+
96
+ dropTable(table);
97
+
98
+ run("/yml/test-insert.yml");
99
+
100
+ assertGeneratedTable1(table);
101
+ }
102
+
92
103
  public void testInsertEmpty() throws Exception
93
104
  {
94
105
  String table = "TEST1";
@@ -101,6 +112,30 @@ public class OracleOutputPluginTestImpl
101
112
  assertTableEmpty(table);
102
113
  }
103
114
 
115
+ public void testTruncateInsert() throws Exception
116
+ {
117
+ String table = "TEST1";
118
+
119
+ dropTable(table);
120
+ createTable(table);
121
+ insertRecord(table);
122
+
123
+ run("/yml/test-truncate-insert.yml");
124
+
125
+ assertTable(table);
126
+ }
127
+
128
+ public void testTruncateInsertCreate() throws Exception
129
+ {
130
+ String table = "TEST1";
131
+
132
+ dropTable(table);
133
+
134
+ run("/yml/test-truncate-insert.yml");
135
+
136
+ assertGeneratedTable1(table);
137
+ }
138
+
104
139
  public void testInsertDirect() throws Exception
105
140
  {
106
141
  String table = "TEST1";
@@ -236,7 +271,7 @@ public class OracleOutputPluginTestImpl
236
271
 
237
272
  public void testReplaceLongNameMultibyte() throws Exception
238
273
  {
239
- String table = "TEST12345678901234567890";
274
+ String table = "TEST123456789012345678";
240
275
 
241
276
  run("/yml/test-replace-long-name-multibyte.yml");
242
277
 
@@ -274,6 +309,11 @@ public class OracleOutputPluginTestImpl
274
309
  executeSQL(sql);
275
310
  }
276
311
 
312
+ private void insertRecord(String table) throws SQLException
313
+ {
314
+ executeSQL(String.format("INSERT INTO %s VALUES('9999', NULL, NULL, NULL, NULL, NULL)", table));
315
+ }
316
+
277
317
  private void assertTable(String table) throws Exception
278
318
  {
279
319
  // datetime of UTC will be inserted by embulk.
@@ -20,7 +20,7 @@ out:
20
20
  database: TESTDB
21
21
  user: TEST_USER
22
22
  password: test_pw
23
- table: TEST12345678901234567890
23
+ table: TEST123456789012345678
24
24
  mode: replace
25
25
  column_options:
26
26
  VARCHAR2_ITEM: {type: 'VARCHAR2(40)'}
@@ -0,0 +1,25 @@
1
+ in:
2
+ type: file
3
+ path_prefix: '/data/test1/test1.csv'
4
+ parser:
5
+ charset: UTF-8
6
+ newline: CRLF
7
+ type: csv
8
+ delimiter: ','
9
+ quote: ''
10
+ columns:
11
+ - {name: ID, type: string}
12
+ - {name: VARCHAR2_ITEM, type: string}
13
+ - {name: INTEGER_ITEM, type: long}
14
+ - {name: NUMBER_ITEM, type: string}
15
+ - {name: DATE_ITEM, type: timestamp, format: '%Y/%m/%d'}
16
+ - {name: TIMESTAMP_ITEM, type: timestamp, format: '%Y/%m/%d %H:%M:%S'}
17
+ out:
18
+ type: oracle
19
+ host: localhost
20
+ database: TESTDB
21
+ user: TEST_USER
22
+ password: test_pw
23
+ table: TEST1
24
+ mode: truncate_insert
25
+ #driver_path: driver/ojdbc7.jar
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-output-oracle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-08 00:00:00.000000000 Z
11
+ date: 2015-12-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Inserts or updates records to a table.
14
14
  email:
@@ -68,9 +68,10 @@ files:
68
68
  - src/test/resources/yml/test-replace-long-name.yml
69
69
  - src/test/resources/yml/test-replace.yml
70
70
  - src/test/resources/yml/test-string-timestamp.yml
71
+ - src/test/resources/yml/test-truncate-insert.yml
71
72
  - src/test/resources/yml/test-url.yml
72
- - classpath/embulk-output-jdbc-0.4.2.jar
73
- - classpath/embulk-output-oracle-0.4.2.jar
73
+ - classpath/embulk-output-jdbc-0.4.3.jar
74
+ - classpath/embulk-output-oracle-0.4.3.jar
74
75
  homepage: https://github.com/embulk/embulk-output-jdbc
75
76
  licenses:
76
77
  - Apache 2.0