embulk-input-oracle 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +52 -2
- data/classpath/embulk-input-jdbc-0.7.3.jar +0 -0
- data/classpath/embulk-input-oracle-0.7.3.jar +0 -0
- data/src/main/java/org/embulk/input/OracleInputPlugin.java +1 -1
- metadata +7 -7
- data/classpath/embulk-input-jdbc-0.7.2.jar +0 -0
- data/classpath/embulk-input-oracle-0.7.2.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f54161ba3352344331934d1663a74df34f46e187
|
4
|
+
data.tar.gz: 91252aaba39988bab74ef588e6ca869f07d231ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a7b17cd0dfdc550f6080ec3a66e5329e3550cfba6ea99a95fb581380fa12bb1bb940391ef923752242e7dca5006145ffd01e4134bf634284ac83e6b2cbc4c14
|
7
|
+
data.tar.gz: 0289d93b1165f39af515bce2fffc443b4378c47f71bb686ab2f0ccff098221a409af6f9ad8f55345f5de7dd20e328405e1b801bdf561ed703235f13f7f865002
|
data/README.md
CHANGED
@@ -21,13 +21,16 @@ Oracle input plugins for Embulk loads records from Oracle.
|
|
21
21
|
- **query**: SQL to run (string)
|
22
22
|
- If **query** is not set,
|
23
23
|
- **table**: destination table name (string, required)
|
24
|
-
- **select**:
|
24
|
+
- **select**: expression of select (e.g. `id, created_at`) (string, default: "*")
|
25
25
|
- **where**: WHERE condition to filter the rows (string, default: no-condition)
|
26
|
-
- **order_by**:
|
26
|
+
- **order_by**: expression of ORDER BY to sort rows (e.g. `created_at DESC, id ASC`) (string, default: not sorted)
|
27
27
|
- **fetch_rows**: number of rows to fetch one time (used for java.sql.Statement#setFetchSize) (integer, default: 10000)
|
28
28
|
- **connect_timeout**: timeout for establishment of a database connection. (integer (seconds), default: 300)
|
29
29
|
- **socket_timeout**: timeout for socket read operations. (integer (seconds), default: 1800)
|
30
30
|
- **options**: extra JDBC properties (hash, default: {})
|
31
|
+
- **incremental**: if true, enables incremental loading. See next section for details (boolean, default: false)
|
32
|
+
- **incremental_columns**: column names for incremental loading (array of strings, default: use primary keys)
|
33
|
+
- **last_record**: values of the last record for incremental loading (array of objects, default: load all records)
|
31
34
|
- **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`)
|
32
35
|
- **column_options**: advanced: a key-value pairs where key is a column name and value is options for the column.
|
33
36
|
- **value_type**: embulk get values from database as this value_type. Typically, the value_type determines `getXXX` method of `java.sql.PreparedStatement`.
|
@@ -40,6 +43,43 @@ Oracle input plugins for Embulk loads records from Oracle.
|
|
40
43
|
(string, value of default_timezone option is used by default)
|
41
44
|
- **after_select**: if set, this SQL will be executed after the SELECT query in the same transaction.
|
42
45
|
|
46
|
+
|
47
|
+
### Incremental loading
|
48
|
+
|
49
|
+
Incremental loading uses monotonically increasing unique columns (such as incremental (SEQUENCE) column) to load records inserted (or updated) after last execution.
|
50
|
+
|
51
|
+
First, if `incremental: true` is set, this plugin loads all records with additional ORDER BY. For example, if `incremental_columns: [updated_at, id]` option is set, query will be as following:
|
52
|
+
|
53
|
+
```
|
54
|
+
SELECT * FROM (
|
55
|
+
...original query is here...
|
56
|
+
)
|
57
|
+
ORDER BY updated_at, id
|
58
|
+
```
|
59
|
+
|
60
|
+
When bulk data loading finishes successfully, it outputs `last_record: ` paramater as config-diff so that next execution uses it.
|
61
|
+
|
62
|
+
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,
|
63
|
+
|
64
|
+
```
|
65
|
+
SELECT * FROM (
|
66
|
+
...original query is here...
|
67
|
+
)
|
68
|
+
WHERE created_at > '2017-01-01 00:32:12' OR (created_at = '2017-01-01 00:32:12' AND id > 5291)
|
69
|
+
ORDER BY updated_at, id
|
70
|
+
```
|
71
|
+
|
72
|
+
Then, it updates `last_record: ` so that next execution uses the updated last_record.
|
73
|
+
|
74
|
+
**IMPORTANT**: If you set `incremental_columns: ` option, make sure that there is an index on the columns to avoid full table scan. For this example, following index should be created:
|
75
|
+
|
76
|
+
```
|
77
|
+
CREATE INDEX embulk_incremental_loading_index ON table (updated_at, id);
|
78
|
+
```
|
79
|
+
|
80
|
+
Recommended usage is to leave `incremental_columns` unset and let this plugin automatically finds a primary key. Currently, only strings and integers are supported as incremental_columns.
|
81
|
+
|
82
|
+
|
43
83
|
## Example
|
44
84
|
|
45
85
|
```yaml
|
@@ -53,6 +93,16 @@ in:
|
|
53
93
|
table: my_table
|
54
94
|
select: "col1, col2, col3"
|
55
95
|
where: "col4 != 'a'"
|
96
|
+
order_by: "col1 DESC"
|
97
|
+
```
|
98
|
+
|
99
|
+
This configuration will generate following SQL:
|
100
|
+
|
101
|
+
```
|
102
|
+
SELECT col1, col2, col3
|
103
|
+
FROM "my_table"
|
104
|
+
WHERE col4 != 'a'
|
105
|
+
ORDER BY col1 DESC
|
56
106
|
```
|
57
107
|
|
58
108
|
If you need a complex SQL,
|
Binary file
|
Binary file
|
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.7.
|
4
|
+
version: 0.7.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: 2016-
|
11
|
+
date: 2016-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Selects records from a table.
|
14
14
|
email:
|
@@ -19,6 +19,8 @@ extra_rdoc_files: []
|
|
19
19
|
files:
|
20
20
|
- README.md
|
21
21
|
- build.gradle
|
22
|
+
- classpath/embulk-input-jdbc-0.7.3.jar
|
23
|
+
- classpath/embulk-input-oracle-0.7.3.jar
|
22
24
|
- lib/embulk/input/oracle.rb
|
23
25
|
- src/main/java/org/embulk/input/OracleInputPlugin.java
|
24
26
|
- src/main/java/org/embulk/input/oracle/OracleInputConnection.java
|
@@ -29,8 +31,6 @@ files:
|
|
29
31
|
- src/test/resources/oracle/yml/input-query-lower.yml
|
30
32
|
- src/test/resources/oracle/yml/input-query.yml
|
31
33
|
- src/test/resources/oracle/yml/input.yml
|
32
|
-
- classpath/embulk-input-jdbc-0.7.2.jar
|
33
|
-
- classpath/embulk-input-oracle-0.7.2.jar
|
34
34
|
homepage: https://github.com/embulk/embulk-input-jdbc
|
35
35
|
licenses:
|
36
36
|
- Apache 2.0
|
@@ -41,17 +41,17 @@ require_paths:
|
|
41
41
|
- lib
|
42
42
|
required_ruby_version: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- -
|
44
|
+
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
47
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
48
|
requirements:
|
49
|
-
- -
|
49
|
+
- - ">="
|
50
50
|
- !ruby/object:Gem::Version
|
51
51
|
version: '0'
|
52
52
|
requirements: []
|
53
53
|
rubyforge_project:
|
54
|
-
rubygems_version: 2.
|
54
|
+
rubygems_version: 2.4.8
|
55
55
|
signing_key:
|
56
56
|
specification_version: 4
|
57
57
|
summary: JDBC input plugin for Embulk
|
Binary file
|
Binary file
|