embulk-input-rethinkdb 0.1.0 → 0.1.1
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/README.md +3 -0
- data/build.gradle +1 -1
- data/src/main/java/org/embulk/input/rethinkdb/RethinkdbInputPlugin.java +26 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21aa87211af2414daa21a3b274500095fa379f7a
|
4
|
+
data.tar.gz: 2bca810caf3003b88f593bce79a458cbc000e045
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 616d24bc4184ccaa8461a5cf593f6d14f3dda00c6bcdba0c69afeb8af80d4354e67abc977cc358c7b29d11dc39977aa173ae0493310b4729eb9810a9b1a8a083
|
7
|
+
data.tar.gz: 9fe40b9bed815b8b02dc095c8bf42a2f6e83db03a8933b5fc047126d80639e8c3832a3eb07fb1e74309d833685e1b980ac627c8ab4ce8d4fa35610521d146fcd
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# RethinkDB input plugin for Embulk
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/embulk-input-rethinkdb)
|
4
|
+
|
3
5
|
RethinkDB input plugin for Embulk loads records from RethinkDB.
|
4
6
|
|
5
7
|
## Overview
|
@@ -16,6 +18,7 @@ RethinkDB input plugin for Embulk loads records from RethinkDB.
|
|
16
18
|
- **database**: database name (string, required)
|
17
19
|
- **user**: database login user name (string, required)
|
18
20
|
- **password**: database login password (string, required)
|
21
|
+
- **cert_file**: path to TLS CA certificate file (string)
|
19
22
|
- **query**: ReQL to run (string, required)
|
20
23
|
- **column_name**: column name used in outputs (string, default: `"record"`)
|
21
24
|
|
data/build.gradle
CHANGED
@@ -25,12 +25,19 @@ import org.embulk.spi.Schema;
|
|
25
25
|
import org.embulk.spi.type.Types;
|
26
26
|
import org.msgpack.value.Value;
|
27
27
|
import org.msgpack.value.ValueFactory;
|
28
|
+
import org.slf4j.Logger;
|
29
|
+
import org.slf4j.LoggerFactory;
|
28
30
|
|
29
31
|
import javax.script.Bindings;
|
30
32
|
import javax.script.ScriptEngine;
|
31
33
|
import javax.script.ScriptEngineManager;
|
32
34
|
import javax.script.ScriptException;
|
33
35
|
|
36
|
+
import java.io.IOException;
|
37
|
+
import java.io.InputStream;
|
38
|
+
import java.nio.file.Files;
|
39
|
+
import java.nio.file.Path;
|
40
|
+
import java.nio.file.Paths;
|
34
41
|
import java.util.ArrayList;
|
35
42
|
import java.util.HashMap;
|
36
43
|
import java.util.List;
|
@@ -81,6 +88,8 @@ public class RethinkdbInputPlugin
|
|
81
88
|
BufferAllocator getBufferAllocator();
|
82
89
|
}
|
83
90
|
|
91
|
+
private static final Logger logger = LoggerFactory.getLogger(RethinkdbInputPlugin.class);
|
92
|
+
|
84
93
|
@Override
|
85
94
|
public ConfigDiff transaction(ConfigSource config,
|
86
95
|
InputPlugin.Control control)
|
@@ -89,9 +98,7 @@ public class RethinkdbInputPlugin
|
|
89
98
|
if (task.getAuthKey().isPresent()) {
|
90
99
|
throw new ConfigException("auth_key option is not supported yet");
|
91
100
|
}
|
92
|
-
|
93
|
-
throw new ConfigException("cert_file option is not supported yet");
|
94
|
-
}
|
101
|
+
|
95
102
|
if (!(task.getUser().isPresent() && task.getPassword().isPresent())) {
|
96
103
|
throw new ConfigException("user and password are needed");
|
97
104
|
}
|
@@ -140,12 +147,25 @@ public class RethinkdbInputPlugin
|
|
140
147
|
throw new ConfigException("ReQL compile error");
|
141
148
|
}
|
142
149
|
|
143
|
-
Connection
|
150
|
+
Connection.Builder builder = r.connection()
|
144
151
|
.hostname(task.getHost())
|
145
152
|
.port(task.getPort())
|
146
153
|
.db(task.getDatabase())
|
147
|
-
.user(task.getUser().get(), task.getPassword().get())
|
148
|
-
|
154
|
+
.user(task.getUser().get(), task.getPassword().get());
|
155
|
+
|
156
|
+
Connection conn;
|
157
|
+
if (task.getCertFile().isPresent()) {
|
158
|
+
Path certFilePath = Paths.get(task.getCertFile().get());
|
159
|
+
try (InputStream is = Files.newInputStream(certFilePath)) {
|
160
|
+
builder.certFile(is);
|
161
|
+
conn = builder.connect();
|
162
|
+
} catch (IOException ex) {
|
163
|
+
throw new ConfigException("error reading TLS certificate file");
|
164
|
+
}
|
165
|
+
}
|
166
|
+
else {
|
167
|
+
conn = builder.connect();
|
168
|
+
}
|
149
169
|
|
150
170
|
Cursor cursor = ast.run(conn);
|
151
171
|
for (Object doc : cursor) {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-input-rethinkdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koji Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -49,7 +49,7 @@ files:
|
|
49
49
|
- LICENSE.txt
|
50
50
|
- README.md
|
51
51
|
- build.gradle
|
52
|
-
- classpath/embulk-input-rethinkdb-0.1.
|
52
|
+
- classpath/embulk-input-rethinkdb-0.1.1.jar
|
53
53
|
- classpath/hamcrest-core-1.1.jar
|
54
54
|
- classpath/json-simple-1.1.1.jar
|
55
55
|
- classpath/junit-4.10.jar
|