embulk-output-oracle 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +155 -110
- data/build.gradle +6 -6
- data/classpath/embulk-output-jdbc-0.3.0.jar +0 -0
- data/classpath/embulk-output-oracle-0.3.0.jar +0 -0
- data/lib/embulk/output/oracle.rb +3 -3
- data/src/main/cpp/common/dir-path-load.cpp +424 -424
- data/src/main/cpp/common/dir-path-load.h +36 -36
- data/src/main/cpp/common/embulk-output-oracle.cpp +196 -196
- data/src/main/cpp/common/org_embulk_output_oracle_oci_OCI.h +77 -77
- data/src/main/cpp/linux/build.sh +21 -21
- data/src/main/cpp/win/build.bat +31 -31
- data/src/main/cpp/win/dllmain.cpp +25 -25
- data/src/main/cpp/win/embulk-output-oracle.sln +39 -39
- data/src/main/cpp/win/embulk-output-oracle.vcxproj +175 -175
- data/src/main/java/org/embulk/output/OracleOutputPlugin.java +22 -66
- data/src/main/java/org/embulk/output/oracle/DirectBatchInsert.java +289 -289
- data/src/main/java/org/embulk/output/oracle/InsertMethod.java +8 -8
- data/src/main/java/org/embulk/output/oracle/OracleCharset.java +32 -19
- data/src/main/java/org/embulk/output/oracle/OracleOutputConnection.java +165 -134
- data/src/main/java/org/embulk/output/oracle/OracleOutputConnector.java +49 -49
- data/src/main/java/org/embulk/output/oracle/TimestampFormat.java +37 -37
- data/src/main/java/org/embulk/output/oracle/oci/ColumnDefinition.java +26 -26
- data/src/main/java/org/embulk/output/oracle/oci/OCI.java +139 -139
- data/src/main/java/org/embulk/output/oracle/oci/OCIManager.java +64 -64
- data/src/main/java/org/embulk/output/oracle/oci/OCIWrapper.java +96 -96
- data/src/main/java/org/embulk/output/oracle/oci/RowBuffer.java +99 -99
- data/src/main/java/org/embulk/output/oracle/oci/TableDefinition.java +24 -24
- data/src/test/cpp/common/embulk-output-oracle-test.cpp +69 -69
- data/src/test/cpp/linux/build.sh +19 -19
- data/src/test/cpp/win/build.bat +28 -28
- data/src/test/cpp/win/embulk-output-oracle-test.vcxproj +154 -154
- data/src/test/java/org/embulk/input/filesplit/LocalFileSplitInputPlugin.java +187 -187
- data/src/test/java/org/embulk/input/filesplit/PartialFile.java +49 -49
- data/src/test/java/org/embulk/input/filesplit/PartialFileInputStream.java +154 -154
- data/src/test/java/org/embulk/output/oracle/ChildFirstClassLoader.java +42 -42
- data/src/test/java/org/embulk/output/oracle/EmbulkPluginTester.java +120 -120
- data/src/test/java/org/embulk/output/oracle/EmptyConfigSource.java +100 -100
- data/src/test/java/org/embulk/output/oracle/OracleOutputPluginTest.java +172 -161
- data/src/test/java/org/embulk/output/oracle/OracleOutputPluginTestImpl.java +445 -413
- data/src/test/java/org/embulk/output/oracle/TimestampFormatTest.java +57 -57
- data/src/test/resources/data/test1/test1.csv +3 -3
- data/src/test/resources/yml/test-insert-direct.yml +26 -26
- data/src/test/resources/yml/test-insert-oci-split.yml +26 -26
- data/src/test/resources/yml/test-insert-oci.yml +26 -26
- data/src/test/resources/yml/test-insert.yml +25 -25
- data/src/test/resources/yml/test-replace-long-name-multibyte.yml +25 -0
- data/src/test/resources/yml/test-replace-long-name.yml +25 -25
- data/src/test/resources/yml/test-replace.yml +25 -25
- data/src/test/resources/yml/test-string-timestamp.yml +25 -0
- data/src/test/resources/yml/test-url.yml +24 -24
- metadata +6 -5
- data/classpath/embulk-output-jdbc-0.2.4.jar +0 -0
- data/classpath/embulk-output-oracle-0.2.4.jar +0 -0
- data/src/main/java/org/embulk/output/oracle/setter/OracleColumnSetterFactory.java +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 216d1163436a4fe62fe244ab857d45e454a86213
|
4
|
+
data.tar.gz: 95dc5c8ef7de58c37f00973a03ef8d4ca8d059c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bacf819a6d2f2c60dd957310bd03558f4212f24f829301576dd7b50b3ca780e2ad32612b5b76eb4459c8950dbe44bc22875cf6a033c6a6ba74faee280f3d261d
|
7
|
+
data.tar.gz: e1dc2c39559cde175cdbc217b0076b71a759bc5bdaef09429146f783a2497a95d81f2df9de67c6ced280695ed0906a38d5e759bc00a9ea2a1560229f0e1b2039
|
data/README.md
CHANGED
@@ -1,110 +1,155 @@
|
|
1
|
-
# Oracle output plugins for Embulk
|
2
|
-
|
3
|
-
Oracle output plugins for Embulk loads records to Oracle.
|
4
|
-
|
5
|
-
## Overview
|
6
|
-
|
7
|
-
* **Plugin type**: output
|
8
|
-
* **Load all or nothing**:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- **
|
16
|
-
- **
|
17
|
-
- **
|
18
|
-
- **
|
19
|
-
- **
|
20
|
-
- **
|
21
|
-
- **
|
22
|
-
- **
|
23
|
-
- **
|
24
|
-
- **
|
25
|
-
- **
|
26
|
-
- **
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
1
|
+
# Oracle output plugins for Embulk
|
2
|
+
|
3
|
+
Oracle output plugins for Embulk loads records to Oracle.
|
4
|
+
|
5
|
+
## Overview
|
6
|
+
|
7
|
+
* **Plugin type**: output
|
8
|
+
* **Load all or nothing**: depnds on the mode. see bellow.
|
9
|
+
* **Resume supported**: depnds on the mode. see bellow.
|
10
|
+
|
11
|
+
## Configuration
|
12
|
+
|
13
|
+
- **driver_path**: path to the jar file of the Oracle JDBC driver (string)
|
14
|
+
- **host**: database host name (string, required if url is not set or insert_method is "oci")
|
15
|
+
- **port**: database port number (integer, default: 1521)
|
16
|
+
- **user**: database login user name (string, required)
|
17
|
+
- **password**: database login password (string, default: "")
|
18
|
+
- **database**: destination database name (string, required if url is not set or insert_method is "oci")
|
19
|
+
- **url**: URL of the JDBC connection (string, optional)
|
20
|
+
- **table**: destination table name (string, required)
|
21
|
+
- **options**: extra connection properties (hash, default: {})
|
22
|
+
- **mode**: "insert", "insert_direct", "truncate_insert", or "replace". See bellow. (string, required)
|
23
|
+
- **insert_method**: see below
|
24
|
+
- **batch_size**: size of a single batch insert (integer, default: 16777216)
|
25
|
+
- **default_timezone**: If input column type (embulk type) is timestamp and destination column type is `string` or `nstring`, this plugin needs to format the timestamp into a string. This default_timezone option is used to control the timezone. You can overwrite timezone for each columns using column_options option. (string, default: `UTC`)
|
26
|
+
- **column_options**: advanced: a key-value pairs where key is a column name and value is options for the column.
|
27
|
+
- **type**: type of a column when this plugin creates new tables (e.g. `VARCHAR(255)`, `INTEGER NOT NULL UNIQUE`). This used when this plugin creates intermediate tables (insert, truncate_insert and merge modes), when it creates the target table (insert_direct and replace modes), and when it creates nonexistent target table automatically. (string, default: depends on input column type. `BIGINT` if input column type is long, `BOOLEAN` if boolean, `DOUBLE PRECISION` if double, `CLOB` if string, `TIMESTAMP` if timestamp)
|
28
|
+
- **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on input column type. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `null`, `pass`)
|
29
|
+
- **timestamp_format**: If input column type (embulk type) is timestamp and value_type is `string` or `nstring`, this plugin needs to format the timestamp value into a string. This timestamp_format option is used to control the format of the timestamp. (string, default: `%Y-%m-%d %H:%M:%S.%6N`)
|
30
|
+
- **timezone**: If input column type (embulk type) is timestamp and value_type is `string` or `nstring`, this plugin needs to format the timestamp value into a string. And if the input column type is timestamp and value_type is `date`, this plugin needs to consider timezone. In those cases, this timezone option is used to control the timezone. (string, value of default_timezone option is used by default)
|
31
|
+
|
32
|
+
### Modes
|
33
|
+
|
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.
|
36
|
+
* Transactional: Yes. This mode successfully writes all rows, or fails with writing zero rows.
|
37
|
+
* Resumable: Yes.
|
38
|
+
* **insert_direct**:
|
39
|
+
* Behavior: This mode inserts rows to the target table directly.
|
40
|
+
* Transactional: No. If fails, the target table could have some rows inserted.
|
41
|
+
* Resumable: No.
|
42
|
+
* **truncate_insert**:
|
43
|
+
* Behavior: Same with `insert` mode excepting that it truncates the target table right before the last `INSERT ...` query.
|
44
|
+
* Transactional: Yes.
|
45
|
+
* Resumable: Yes.
|
46
|
+
* **replace**:
|
47
|
+
* Behavior: Same with `insert` mode excepting that it truncates the target table right before the last `INSERT ...` query.
|
48
|
+
* Transactional: Yes.
|
49
|
+
* Resumable: No.
|
50
|
+
|
51
|
+
### Insert modes
|
52
|
+
|
53
|
+
insert_method supports three options.
|
54
|
+
|
55
|
+
"normal" means normal insert (default). It requires Oracle JDBC driver.
|
56
|
+
|
57
|
+
"direct" means direct path insert. It is faster than 'normal.
|
58
|
+
It requires Oracle JDBC driver too, but the version 12 driver doesn't work (the version 11 driver works).
|
59
|
+
|
60
|
+
"oci" means direct path insert using OCI(Oracle Call Interface). It is fastest.
|
61
|
+
It requires both Oracle JDBC driver and Oracle Instant Client (version 12.1.0.2.0).
|
62
|
+
You must set the library loading path to the OCI library.
|
63
|
+
|
64
|
+
If you use "oci", platform dependent library written in cpp is required.
|
65
|
+
Windows(x64) library and Linux(x64) are bundled, but others are not bundled.
|
66
|
+
You should build by yourself and set the library loading path to it.
|
67
|
+
|
68
|
+
### Example
|
69
|
+
|
70
|
+
```yaml
|
71
|
+
out:
|
72
|
+
type: oracle
|
73
|
+
driver_path: /opt/oracle/ojdbc6.jar
|
74
|
+
host: localhost
|
75
|
+
user: root
|
76
|
+
password: ""
|
77
|
+
database: my_database
|
78
|
+
table: my_table
|
79
|
+
mode: insert
|
80
|
+
insert_method: direct
|
81
|
+
```
|
82
|
+
|
83
|
+
Advanced configuration:
|
84
|
+
|
85
|
+
```yaml
|
86
|
+
out:
|
87
|
+
type: oracle
|
88
|
+
driver_path: /opt/oracle/ojdbc6.jar
|
89
|
+
host: localhost
|
90
|
+
user: root
|
91
|
+
password: ""
|
92
|
+
database: my_database
|
93
|
+
table: my_table
|
94
|
+
options: {LoginTimeout: 20000}
|
95
|
+
mode: insert_direct
|
96
|
+
insert_method: direct
|
97
|
+
column_options:
|
98
|
+
my_col_1: {type: 'VARCHAR(255)'}
|
99
|
+
my_col_3: {type: 'INT NOT NULL'}
|
100
|
+
my_col_4: {value_type: string, timestamp_format: `%Y-%m-%d %H:%M:%S %z`, timezone: '-0700'}
|
101
|
+
my_col_5: {type: 'DECIMAL(18,9)', value_type: pass}
|
102
|
+
```
|
103
|
+
|
104
|
+
### Build
|
105
|
+
|
106
|
+
```
|
107
|
+
$ ./gradlew gem
|
108
|
+
```
|
109
|
+
|
110
|
+
#### Build environment for native library
|
111
|
+
|
112
|
+
For Windows (x64)
|
113
|
+
|
114
|
+
(1) Install JDK.
|
115
|
+
|
116
|
+
(2) Install Microsoft Visual Studio (only 2010 is tested).
|
117
|
+
|
118
|
+
(3) Install Oracle Instant Client SDK 11.1.0.6.0 for Microsoft Windows (x64).
|
119
|
+
|
120
|
+
(4) Set environment variables.
|
121
|
+
|
122
|
+
* JAVA_HOME
|
123
|
+
* OCI\_SDK_PATH ("sdk" directory of Oracle Instant Client)
|
124
|
+
|
125
|
+
(5) Open src/main/cpp/win/embulk-output-oracle.sln by Visual Studio and build.
|
126
|
+
|
127
|
+
For Windows command line, the following are needed in addition to (1) - (4).
|
128
|
+
|
129
|
+
(6) Set environment variables.
|
130
|
+
|
131
|
+
* MSVC_PATH (ex. C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC)
|
132
|
+
* MSSDK_PATH (ex. C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A)
|
133
|
+
|
134
|
+
(7) Execute src/main/cpp/win/build.bat .
|
135
|
+
|
136
|
+
|
137
|
+
For Linux (x64) (only Ubuntu Server 14.04 is tested)
|
138
|
+
|
139
|
+
(1) Install JDK.
|
140
|
+
|
141
|
+
(2) Install gcc and g++ .
|
142
|
+
|
143
|
+
(3) Install Oracle Instant Client Basic and SDK 11.1.0.6.0 for Linux (x64).
|
144
|
+
|
145
|
+
(4) Create symbolic links of OCI libraries.
|
146
|
+
|
147
|
+
ln -s libocci.so.11.1 libocci.so
|
148
|
+
ln -s libclntsh.so.11.1 libclntsh.so
|
149
|
+
|
150
|
+
(5) Set environment variables.
|
151
|
+
|
152
|
+
* JAVA_HOME
|
153
|
+
* OCI_PATH (the directory of Oracle Instant Client Basic and the parent of the "sdk" directory)
|
154
|
+
|
155
|
+
(6) Execute src/main/cpp/linux/build.sh .
|
data/build.gradle
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
[compileTestJava]*.options*.encoding = 'UTF-8'
|
2
|
-
|
3
|
-
dependencies {
|
4
|
-
compile project(':embulk-output-jdbc')
|
5
|
-
testCompile 'org.embulk:embulk-standards:0.5.5'
|
6
|
-
}
|
1
|
+
[compileTestJava]*.options*.encoding = 'UTF-8'
|
2
|
+
|
3
|
+
dependencies {
|
4
|
+
compile project(':embulk-output-jdbc')
|
5
|
+
testCompile 'org.embulk:embulk-standards:0.5.5'
|
6
|
+
}
|
Binary file
|
Binary file
|
data/lib/embulk/output/oracle.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
Embulk::JavaPlugin.register_output(
|
2
|
-
:oracle, "org.embulk.output.OracleOutputPlugin",
|
3
|
-
File.expand_path('../../../../classpath', __FILE__))
|
1
|
+
Embulk::JavaPlugin.register_output(
|
2
|
+
:oracle, "org.embulk.output.OracleOutputPlugin",
|
3
|
+
File.expand_path('../../../../classpath', __FILE__))
|