embulk-input-jdbc 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/classpath/{embulk-input-jdbc-0.6.0.jar → embulk-input-jdbc-0.6.1.jar} +0 -0
- data/src/main/java/org/embulk/input/jdbc/AbstractJdbcInputPlugin.java +14 -6
- data/src/main/java/org/embulk/input/jdbc/JdbcColumn.java +0 -1
- data/src/main/java/org/embulk/input/jdbc/JdbcInputConnection.java +4 -3
- data/src/main/java/org/embulk/input/jdbc/ToStringMap.java +0 -1
- 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: 7174c1ad10ec5dd300afc371676a7cad51359a68
|
4
|
+
data.tar.gz: 7fab375bd50f0ef627743bb657d57bcd0501ca49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71b7cc73f16de4b2a2ca79a612d3a26b0b2c7d077a2d9ca87f0fbcea500ab069a367cd93480b7c436afd8098514139d9085f13e9849d8024caebde1eb9147524
|
7
|
+
data.tar.gz: cffdf1296b5955170b2f4dbba778bf1065b5e72f2067d94f40e5e0a4e84e3a34413549f5a165de2c19f97c55c0ca401610d460fdd4a5e98d77c0df8b2c2520c4
|
Binary file
|
@@ -13,7 +13,6 @@ import com.google.common.base.Supplier;
|
|
13
13
|
import com.google.common.base.Throwables;
|
14
14
|
import com.google.common.collect.ImmutableList;
|
15
15
|
|
16
|
-
import org.embulk.config.CommitReport;
|
17
16
|
import org.embulk.config.Config;
|
18
17
|
import org.embulk.config.ConfigException;
|
19
18
|
import org.embulk.config.ConfigDefault;
|
@@ -21,6 +20,7 @@ import org.embulk.config.ConfigDiff;
|
|
21
20
|
import org.embulk.config.ConfigInject;
|
22
21
|
import org.embulk.config.ConfigSource;
|
23
22
|
import org.embulk.config.Task;
|
23
|
+
import org.embulk.config.TaskReport;
|
24
24
|
import org.embulk.config.TaskSource;
|
25
25
|
import org.embulk.plugin.PluginClassLoader;
|
26
26
|
import org.embulk.spi.BufferAllocator;
|
@@ -97,6 +97,14 @@ public abstract class AbstractJdbcInputPlugin
|
|
97
97
|
//@ConfigDefault("null")
|
98
98
|
//public Optional<Integer> getLimitRows();
|
99
99
|
|
100
|
+
@Config("connect_timeout")
|
101
|
+
@ConfigDefault("300")
|
102
|
+
public int getConnectTimeout();
|
103
|
+
|
104
|
+
@Config("socket_timeout")
|
105
|
+
@ConfigDefault("1800")
|
106
|
+
public int getSocketTimeout();
|
107
|
+
|
100
108
|
@Config("fetch_rows")
|
101
109
|
@ConfigDefault("10000")
|
102
110
|
// TODO set minimum number
|
@@ -203,7 +211,7 @@ public abstract class AbstractJdbcInputPlugin
|
|
203
211
|
return Exec.newConfigDiff();
|
204
212
|
}
|
205
213
|
|
206
|
-
protected ConfigDiff buildNextConfigDiff(PluginTask task, List<
|
214
|
+
protected ConfigDiff buildNextConfigDiff(PluginTask task, List<TaskReport> reports)
|
207
215
|
{
|
208
216
|
ConfigDiff next = Exec.newConfigDiff();
|
209
217
|
// TODO
|
@@ -218,13 +226,13 @@ public abstract class AbstractJdbcInputPlugin
|
|
218
226
|
@Override
|
219
227
|
public void cleanup(TaskSource taskSource,
|
220
228
|
Schema schema, int taskCount,
|
221
|
-
List<
|
229
|
+
List<TaskReport> successTaskReports)
|
222
230
|
{
|
223
231
|
// do nothing
|
224
232
|
}
|
225
233
|
|
226
234
|
@Override
|
227
|
-
public
|
235
|
+
public TaskReport run(TaskSource taskSource,
|
228
236
|
Schema schema, int taskIndex,
|
229
237
|
PageOutput output)
|
230
238
|
{
|
@@ -238,7 +246,7 @@ public abstract class AbstractJdbcInputPlugin
|
|
238
246
|
List<ColumnGetter> getters = newColumnGetters(task, querySchema, pageBuilder);
|
239
247
|
|
240
248
|
try (JdbcInputConnection con = newConnection(task)) {
|
241
|
-
try (BatchSelect cursor = con.newSelectCursor(getQuery(task, con), task.getFetchRows())) {
|
249
|
+
try (BatchSelect cursor = con.newSelectCursor(getQuery(task, con), task.getFetchRows(), task.getSocketTimeout())) {
|
242
250
|
while (true) {
|
243
251
|
// TODO run fetch() in another thread asynchronously
|
244
252
|
// TODO retry fetch() if it failed (maybe order_by is required and unique_column(s) option is also required)
|
@@ -255,7 +263,7 @@ public abstract class AbstractJdbcInputPlugin
|
|
255
263
|
}
|
256
264
|
pageBuilder.finish();
|
257
265
|
|
258
|
-
|
266
|
+
TaskReport report = Exec.newTaskReport();
|
259
267
|
// TODO
|
260
268
|
//if (orderByColumn != null) {
|
261
269
|
// report.set("last_value", lastValue);
|
@@ -66,16 +66,17 @@ public class JdbcInputConnection
|
|
66
66
|
return new JdbcSchema(columns.build());
|
67
67
|
}
|
68
68
|
|
69
|
-
public BatchSelect newSelectCursor(String query, int fetchRows) throws SQLException
|
69
|
+
public BatchSelect newSelectCursor(String query, int fetchRows, int queryTimeout) throws SQLException
|
70
70
|
{
|
71
|
-
return newBatchSelect(query, fetchRows);
|
71
|
+
return newBatchSelect(query, fetchRows, queryTimeout);
|
72
72
|
}
|
73
73
|
|
74
|
-
protected BatchSelect newBatchSelect(String query, int fetchRows) throws SQLException
|
74
|
+
protected BatchSelect newBatchSelect(String query, int fetchRows, int queryTimeout) throws SQLException
|
75
75
|
{
|
76
76
|
logger.info("SQL: " + query);
|
77
77
|
PreparedStatement stmt = connection.prepareStatement(query);
|
78
78
|
stmt.setFetchSize(fetchRows);
|
79
|
+
stmt.setQueryTimeout(queryTimeout);
|
79
80
|
return new SingleSelect(stmt);
|
80
81
|
}
|
81
82
|
|
@@ -6,7 +6,6 @@ import java.util.Properties;
|
|
6
6
|
import com.google.common.base.Function;
|
7
7
|
import com.google.common.collect.Maps;
|
8
8
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
9
|
-
import com.fasterxml.jackson.annotation.JsonValue;
|
10
9
|
|
11
10
|
// TODO copied from embulk-output-jdbc. Move this class to embulk-core spi.unit.
|
12
11
|
public class ToStringMap
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-input-jdbc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
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-
|
11
|
+
date: 2015-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Selects records from a table.
|
14
14
|
email:
|
@@ -40,7 +40,7 @@ files:
|
|
40
40
|
- src/main/java/org/embulk/input/jdbc/getter/StringColumnGetter.java
|
41
41
|
- src/main/java/org/embulk/input/jdbc/getter/TimeColumnGetter.java
|
42
42
|
- src/main/java/org/embulk/input/jdbc/getter/TimestampColumnGetter.java
|
43
|
-
- classpath/embulk-input-jdbc-0.6.
|
43
|
+
- classpath/embulk-input-jdbc-0.6.1.jar
|
44
44
|
homepage: https://github.com/embulk/embulk-input-jdbc
|
45
45
|
licenses:
|
46
46
|
- Apache 2.0
|