embulk-input-mysql 0.2.3 → 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 +1 -1
- data/classpath/{embulk-input-jdbc-0.2.3.jar → embulk-input-jdbc-0.3.0.jar} +0 -0
- data/classpath/embulk-input-mysql-0.3.0.jar +0 -0
- data/src/main/java/org/embulk/input/MySQLInputPlugin.java +35 -8
- metadata +4 -4
- data/classpath/embulk-input-mysql-0.2.3.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: 1563f9a4c9fdb1322b933d81c68b64a886e804db
|
4
|
+
data.tar.gz: 38eb126ea3df749ac37661d04d19c510842b7d4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e077bc4ffb80e9a6179def26c1ae3d5ac796707548e6868bfae34677889c4a6229a518a46f024c49ed90a2b20e330c9ce7c432e19421e434ad7c7bcd962e643
|
7
|
+
data.tar.gz: 38e6f22cf05ad7ee8d6eb753304241c0fbd733afacc55d867563e8b0866573773adf5c6ccb2822c3e46a86ca35fb6553d7c1df7ee71394990a440c62da45e48b
|
data/README.md
CHANGED
@@ -14,7 +14,7 @@ MySQL input plugins for Embulk loads records from MySQL.
|
|
14
14
|
- **user**: database login user name (string, required)
|
15
15
|
- **password**: database login password (string, default: "")
|
16
16
|
- **database**: destination database name (string, required)
|
17
|
-
- **table**: destination name (string, required)
|
17
|
+
- **table**: destination table name (string, required)
|
18
18
|
- **select**: comma-separated list of columns to select (string, default: "*")
|
19
19
|
- **where**: WHERE condition to filter the rows (string, default: no-condition)
|
20
20
|
- **fetch_rows**: number of rows to fetch one time (integer, default: 10000)
|
Binary file
|
Binary file
|
@@ -13,17 +13,44 @@ import org.embulk.input.mysql.MySQLInputConnection;
|
|
13
13
|
public class MySQLInputPlugin
|
14
14
|
extends AbstractJdbcInputPlugin
|
15
15
|
{
|
16
|
-
|
16
|
+
public interface MySQLPluginTask
|
17
|
+
extends PluginTask
|
18
|
+
{
|
19
|
+
@Config("host")
|
20
|
+
public String getHost();
|
21
|
+
|
22
|
+
@Config("port")
|
23
|
+
@ConfigDefault("3306")
|
24
|
+
public int getPort();
|
25
|
+
|
26
|
+
@Config("user")
|
27
|
+
public String getUser();
|
28
|
+
|
29
|
+
@Config("password")
|
30
|
+
@ConfigDefault("\"\"")
|
31
|
+
public String getPassword();
|
32
|
+
|
33
|
+
@Config("database")
|
34
|
+
public String getDatabase();
|
35
|
+
}
|
36
|
+
|
37
|
+
@Override
|
38
|
+
protected Class<? extends PluginTask> getTaskClass()
|
39
|
+
{
|
40
|
+
return MySQLPluginTask.class;
|
41
|
+
}
|
17
42
|
|
18
43
|
@Override
|
19
44
|
protected MySQLInputConnection newConnection(PluginTask task) throws SQLException
|
20
45
|
{
|
46
|
+
MySQLPluginTask t = (MySQLPluginTask) task;
|
47
|
+
|
21
48
|
String url = String.format("jdbc:mysql://%s:%d/%s",
|
22
|
-
|
49
|
+
t.getHost(), t.getPort(), t.getDatabase());
|
23
50
|
|
24
51
|
Properties props = new Properties();
|
25
|
-
props.setProperty("user",
|
26
|
-
props.setProperty("password",
|
52
|
+
props.setProperty("user", t.getUser());
|
53
|
+
props.setProperty("password", t.getPassword());
|
27
54
|
|
28
55
|
// convert 0000-00-00 to NULL to avoid this exceptoin:
|
29
56
|
// java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Date
|
@@ -54,16 +81,16 @@ public class MySQLInputPlugin
|
|
54
81
|
// break;
|
55
82
|
//}
|
56
83
|
|
57
|
-
if (
|
84
|
+
if (t.getFetchRows() == 1) {
|
58
85
|
logger.info("Fetch size is 1. Fetching rows one by one.");
|
59
|
-
} else if (
|
86
|
+
} else if (t.getFetchRows() <= 0) {
|
60
87
|
logger.info("Fetch size is set to -1. Fetching all rows at once.");
|
61
88
|
} else {
|
62
|
-
logger.info("Fetch size is {}. Using server-side prepared statement.",
|
89
|
+
logger.info("Fetch size is {}. Using server-side prepared statement.", t.getFetchRows());
|
63
90
|
props.setProperty("useCursorFetch", "true");
|
64
91
|
}
|
65
92
|
|
66
|
-
props.putAll(
|
93
|
+
props.putAll(t.getOptions());
|
67
94
|
|
68
95
|
Driver driver;
|
69
96
|
try {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-input-mysql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
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-02-
|
11
|
+
date: 2015-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Selects records from a table.
|
14
14
|
email:
|
@@ -22,8 +22,8 @@ files:
|
|
22
22
|
- lib/embulk/input/mysql.rb
|
23
23
|
- src/main/java/org/embulk/input/MySQLInputPlugin.java
|
24
24
|
- src/main/java/org/embulk/input/mysql/MySQLInputConnection.java
|
25
|
-
- classpath/embulk-input-jdbc-0.
|
26
|
-
- classpath/embulk-input-mysql-0.
|
25
|
+
- classpath/embulk-input-jdbc-0.3.0.jar
|
26
|
+
- classpath/embulk-input-mysql-0.3.0.jar
|
27
27
|
- classpath/mysql-connector-java-5.1.34.jar
|
28
28
|
homepage: https://github.com/embulk/embulk-input-jdbc
|
29
29
|
licenses:
|
Binary file
|