embulk-filter-oracle_lookup 0.1.0 → 0.2.0
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 +4 -4
- data/{LICENSE.txt → LICENSE} +0 -0
- data/README.md +15 -2
- data/build.gradle +1 -1
- data/classpath/embulk-filter-oracle_lookup-0.2.0.jar +0 -0
- data/example/config.yml +2 -2
- data/screenshots/logo.png +0 -0
- data/src/main/java/org/embulk/filter/oracle_lookup/OracleConnection.java +12 -7
- data/src/main/java/org/embulk/filter/oracle_lookup/OracleLookupFilterPlugin.java +32 -21
- metadata +5 -4
- data/classpath/embulk-filter-oracle_lookup-0.1.0.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7407cfe1f3eec44230c5110dfef213e3346fe52940d4d45850081a53ec37fd3e
|
4
|
+
data.tar.gz: aa1fc40140632a49db977e59e684506e9b08ccc0925fe77ddfd29571d508bb9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 202f64e9d632764ca57353b584f528f07130576f15c9afaad0517804d3ec1f7b739cf712f7d573cefb97ffad2cbb7cea1bb60b8211a8813e332720f0f14dbd5d
|
7
|
+
data.tar.gz: adf20f498eee0023bca5b5f95df59660442d36fa5a069b6e29bfcb5134750b0eda854db82aac46cc12d0943e4d9088fb65467ed9e02ae3c5782b1b14aec241c9
|
data/{LICENSE.txt → LICENSE}
RENAMED
File without changes
|
data/README.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
|
2
|
+
<p align="center">
|
3
|
+
<a href="https://www.infoobjects.com/" target="blank"><img src="screenshots/logo.png" width="150" alt="InfoObjects Logo" /></a>
|
4
|
+
</p>
|
5
|
+
<p align="center">Infoobjects is a consulting company that helps enterprises transform how and where they run applications and infrastructure.
|
6
|
+
From strategy, to implementation, to ongoing managed services, Infoobjects creates tailored cloud solutions for enterprises at all stages of the cloud journey.</p>
|
7
|
+
|
8
|
+
# Postgres lookup filter plugin for Embulk
|
9
|
+
[](LICENSE)
|
10
|
+
|
1
11
|
# Oracle lookup filter plugin for Embulk
|
2
12
|
|
3
13
|
An Embulk filter plugin for Lookup Transformation with Oracle database
|
@@ -8,7 +18,7 @@ An Embulk filter plugin for Lookup Transformation with Oracle database
|
|
8
18
|
- **host**: database host (example `localhost`) (required)
|
9
19
|
- **port**: database port (example port for oracle `1521`) (required)
|
10
20
|
- **database**: database name (required)
|
11
|
-
- **
|
21
|
+
- **table**: table name of your database (required)
|
12
22
|
- **username**: username for your database (required)
|
13
23
|
- **password**: password for database (required)
|
14
24
|
- **mapping_from**: (Name of columns to be matched with table 2 columns) (required)
|
@@ -131,4 +141,7 @@ Release gem:
|
|
131
141
|
|
132
142
|
```
|
133
143
|
$ ./gradlew gemPush
|
134
|
-
```
|
144
|
+
```
|
145
|
+
## Licensing
|
146
|
+
|
147
|
+
InfoObjects [license](LICENSE) (MIT License)
|
data/build.gradle
CHANGED
Binary file
|
data/example/config.yml
CHANGED
@@ -3,7 +3,7 @@ exec:
|
|
3
3
|
min_output_tasks: 1
|
4
4
|
in:
|
5
5
|
type: file
|
6
|
-
path_prefix: C:\Users\Abhishek Gupta\Desktop\
|
6
|
+
path_prefix: C:\Users\Abhishek Gupta\Desktop\github\embulk-filter-oracle_lookup\calendar.csv
|
7
7
|
parser:
|
8
8
|
type: csv
|
9
9
|
columns:
|
@@ -17,7 +17,7 @@ filters:
|
|
17
17
|
host: localhost
|
18
18
|
port: 1521
|
19
19
|
database: XE
|
20
|
-
|
20
|
+
table: country
|
21
21
|
username: sys as sysdba
|
22
22
|
password: root
|
23
23
|
mapping_from:
|
Binary file
|
@@ -2,6 +2,7 @@ package org.embulk.filter.oracle_lookup;
|
|
2
2
|
|
3
3
|
import java.sql.Connection;
|
4
4
|
import java.sql.DriverManager;
|
5
|
+
import java.sql.SQLException;
|
5
6
|
|
6
7
|
public class OracleConnection {
|
7
8
|
|
@@ -20,14 +21,18 @@ public class OracleConnection {
|
|
20
21
|
}
|
21
22
|
|
22
23
|
public static Connection getConnection(OracleLookupFilterPlugin.PluginTask task){
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
e
|
29
|
-
|
24
|
+
try {
|
25
|
+
if(connection==null || connection.isClosed()){
|
26
|
+
try {
|
27
|
+
new OracleConnection(task);
|
28
|
+
return connection;
|
29
|
+
} catch (Exception e) {
|
30
|
+
e.printStackTrace();
|
31
|
+
throw new RuntimeException();
|
32
|
+
}
|
30
33
|
}
|
34
|
+
}catch (Exception e){
|
35
|
+
throw new RuntimeException(e);
|
31
36
|
}
|
32
37
|
return connection;
|
33
38
|
}
|
@@ -29,7 +29,7 @@ public class OracleLookupFilterPlugin
|
|
29
29
|
@Config("database")
|
30
30
|
public String getDatabase();
|
31
31
|
|
32
|
-
@Config("
|
32
|
+
@Config("table")
|
33
33
|
public String getTableName();
|
34
34
|
|
35
35
|
@Config("username")
|
@@ -246,38 +246,49 @@ public class OracleLookupFilterPlugin
|
|
246
246
|
|
247
247
|
private void add_builder(int colNum, Column column, List<String> searchingKeyData, List<String> inputColumns, Map<String, Integer> keyMap) {
|
248
248
|
if (Types.STRING.equals(column.getType())) {
|
249
|
-
if (
|
250
|
-
|
251
|
-
|
252
|
-
|
249
|
+
if (keyMap.get("Key") < inputColumns.size()) {
|
250
|
+
if (column.getName().equalsIgnoreCase(inputColumns.get(keyMap.get("Key")))) {
|
251
|
+
searchingKeyData.add(reader.getString(column));
|
252
|
+
int key = keyMap.get("Key");
|
253
|
+
keyMap.put("Key", ++key);
|
254
|
+
}
|
253
255
|
}
|
254
256
|
builder.setString(colNum, reader.getString(column));
|
255
257
|
} else if (Types.BOOLEAN.equals(column.getType())) {
|
256
|
-
if (
|
257
|
-
|
258
|
-
|
259
|
-
|
258
|
+
if (keyMap.get("Key") < inputColumns.size()) {
|
259
|
+
if (column.getName().equalsIgnoreCase(inputColumns.get(keyMap.get("Key")))) {
|
260
|
+
searchingKeyData.add(String.valueOf(reader.getBoolean(column)));
|
261
|
+
int key = keyMap.get("Key");
|
262
|
+
keyMap.put("Key", ++key);
|
263
|
+
}
|
260
264
|
}
|
261
265
|
builder.setBoolean(colNum, reader.getBoolean(column));
|
262
266
|
} else if (Types.DOUBLE.equals(column.getType())) {
|
263
|
-
if (
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
+
if (keyMap.get("Key") < inputColumns.size()) {
|
268
|
+
if (column.getName().equalsIgnoreCase(inputColumns.get(keyMap.get("Key")))) {
|
269
|
+
searchingKeyData.add(String.valueOf(reader.getDouble(column)));
|
270
|
+
int key = keyMap.get("Key");
|
271
|
+
keyMap.put("Key", ++key);
|
272
|
+
}
|
267
273
|
}
|
268
274
|
builder.setDouble(colNum, reader.getDouble(column));
|
269
275
|
} else if (Types.LONG.equals(column.getType())) {
|
270
|
-
if (
|
271
|
-
|
272
|
-
|
273
|
-
|
276
|
+
if (keyMap.get("Key") < inputColumns.size()) {
|
277
|
+
if (column.getName().equalsIgnoreCase(inputColumns.get(keyMap.get("Key")))) {
|
278
|
+
searchingKeyData.add(String.valueOf(reader.getLong(column)));
|
279
|
+
int key = keyMap.get("Key");
|
280
|
+
keyMap.put("Key", ++key);
|
281
|
+
}
|
274
282
|
}
|
283
|
+
|
275
284
|
builder.setLong(colNum, reader.getLong(column));
|
276
285
|
} else if (Types.TIMESTAMP.equals(column.getType())) {
|
277
|
-
if (
|
278
|
-
|
279
|
-
|
280
|
-
|
286
|
+
if (keyMap.get("Key") < inputColumns.size()) {
|
287
|
+
if (column.getName().equalsIgnoreCase(inputColumns.get(keyMap.get("Key")))) {
|
288
|
+
searchingKeyData.add(String.valueOf(reader.getTimestamp(column)));
|
289
|
+
int key = keyMap.get("Key");
|
290
|
+
keyMap.put("Key", ++key);
|
291
|
+
}
|
281
292
|
}
|
282
293
|
builder.setTimestamp(colNum, reader.getTimestamp(column));
|
283
294
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-filter-oracle_lookup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Infoobjects Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -46,11 +46,11 @@ extensions: []
|
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
48
|
- ".gitignore"
|
49
|
-
- LICENSE
|
49
|
+
- LICENSE
|
50
50
|
- README.md
|
51
51
|
- build.gradle
|
52
52
|
- calendar.csv
|
53
|
-
- classpath/embulk-filter-oracle_lookup-0.
|
53
|
+
- classpath/embulk-filter-oracle_lookup-0.2.0.jar
|
54
54
|
- classpath/mysql-connector-java-8.0.19.jar
|
55
55
|
- classpath/protobuf-java-3.6.1.jar
|
56
56
|
- config/checkstyle/checkstyle.xml
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- gradlew
|
62
62
|
- gradlew.bat
|
63
63
|
- lib/embulk/filter/oracle_lookup.rb
|
64
|
+
- screenshots/logo.png
|
64
65
|
- src/main/java/org/embulk/filter/oracle_lookup/OracleConnection.java
|
65
66
|
- src/main/java/org/embulk/filter/oracle_lookup/OracleLookupFilterPlugin.java
|
66
67
|
- src/test/java/org/embulk/filter/oracle_lookup/TestOracleLookupFilterPlugin.java
|
Binary file
|