embulk-output-mysql 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +42 -42
- data/build.gradle +7 -7
- data/classpath/{embulk-output-jdbc-0.2.3.jar → embulk-output-jdbc-0.2.4.jar} +0 -0
- data/classpath/{embulk-output-mysql-0.2.3.jar → embulk-output-mysql-0.2.4.jar} +0 -0
- data/lib/embulk/output/mysql.rb +3 -3
- data/src/main/java/org/embulk/output/mysql/MySQLBatchInsert.java +36 -36
- data/src/main/java/org/embulk/output/mysql/MySQLOutputConnector.java +42 -42
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54ae48d0cd8f8a4b20e470008c338d7f8f50a15f
|
4
|
+
data.tar.gz: 30910e0ea400a868af1e9869ac4337029af5b02a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7ec8503e5ecd071de55099962d4bc1937ff49333110577e53310ba1d110a01f1b1c5f7d0659c6802db75fa888a91079f72ad98afd36c8482171531e35233664
|
7
|
+
data.tar.gz: 7db52807e1444a4a17038720fc59ffafa9b9c87b83b83433a0acd693f809746e7a76a325adde92d6e8e79b0fe077e4a050ceb193327aa442a10710d6e35afe67
|
data/README.md
CHANGED
@@ -1,42 +1,42 @@
|
|
1
|
-
# MySQL output plugins for Embulk
|
2
|
-
|
3
|
-
MySQL output plugins for Embulk loads records to MySQL.
|
4
|
-
|
5
|
-
## Overview
|
6
|
-
|
7
|
-
* **Plugin type**: output
|
8
|
-
* **Load all or nothing**: depnds on the mode:
|
9
|
-
* **insert**: no
|
10
|
-
* **replace**: yes
|
11
|
-
* **Resume supported**: no
|
12
|
-
|
13
|
-
## Configuration
|
14
|
-
|
15
|
-
- **host**: database host name (string, required)
|
16
|
-
- **port**: database port number (integer, default: 3306)
|
17
|
-
- **user**: database login user name (string, required)
|
18
|
-
- **password**: database login password (string, default: "")
|
19
|
-
- **database**: destination database name (string, required)
|
20
|
-
- **table**: destination table name (string, required)
|
21
|
-
- **mode**: "replace" or "insert" (string, required)
|
22
|
-
- **batch_size**: size of a single batch insert (integer, default: 16777216)
|
23
|
-
- **options**: extra connection properties (hash, default: {})
|
24
|
-
|
25
|
-
### Example
|
26
|
-
|
27
|
-
```yaml
|
28
|
-
out:
|
29
|
-
type: mysql
|
30
|
-
host: localhost
|
31
|
-
user: root
|
32
|
-
password: ""
|
33
|
-
database: my_database
|
34
|
-
table: my_table
|
35
|
-
mode: insert
|
36
|
-
```
|
37
|
-
|
38
|
-
### Build
|
39
|
-
|
40
|
-
```
|
41
|
-
$ ./gradlew gem
|
42
|
-
```
|
1
|
+
# MySQL output plugins for Embulk
|
2
|
+
|
3
|
+
MySQL output plugins for Embulk loads records to MySQL.
|
4
|
+
|
5
|
+
## Overview
|
6
|
+
|
7
|
+
* **Plugin type**: output
|
8
|
+
* **Load all or nothing**: depnds on the mode:
|
9
|
+
* **insert**: no
|
10
|
+
* **replace**: yes
|
11
|
+
* **Resume supported**: no
|
12
|
+
|
13
|
+
## Configuration
|
14
|
+
|
15
|
+
- **host**: database host name (string, required)
|
16
|
+
- **port**: database port number (integer, default: 3306)
|
17
|
+
- **user**: database login user name (string, required)
|
18
|
+
- **password**: database login password (string, default: "")
|
19
|
+
- **database**: destination database name (string, required)
|
20
|
+
- **table**: destination table name (string, required)
|
21
|
+
- **mode**: "replace", "merge" or "insert" (string, required)
|
22
|
+
- **batch_size**: size of a single batch insert (integer, default: 16777216)
|
23
|
+
- **options**: extra connection properties (hash, default: {})
|
24
|
+
|
25
|
+
### Example
|
26
|
+
|
27
|
+
```yaml
|
28
|
+
out:
|
29
|
+
type: mysql
|
30
|
+
host: localhost
|
31
|
+
user: root
|
32
|
+
password: ""
|
33
|
+
database: my_database
|
34
|
+
table: my_table
|
35
|
+
mode: insert
|
36
|
+
```
|
37
|
+
|
38
|
+
### Build
|
39
|
+
|
40
|
+
```
|
41
|
+
$ ./gradlew gem
|
42
|
+
```
|
data/build.gradle
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
dependencies {
|
2
|
-
compile project(':embulk-output-jdbc')
|
3
|
-
|
4
|
-
compile 'mysql:mysql-connector-java:5.1.34'
|
5
|
-
|
6
|
-
testCompile project(':embulk-output-jdbc').sourceSets.test.output
|
7
|
-
}
|
1
|
+
dependencies {
|
2
|
+
compile project(':embulk-output-jdbc')
|
3
|
+
|
4
|
+
compile 'mysql:mysql-connector-java:5.1.34'
|
5
|
+
|
6
|
+
testCompile project(':embulk-output-jdbc').sourceSets.test.output
|
7
|
+
}
|
Binary file
|
Binary file
|
data/lib/embulk/output/mysql.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
Embulk::JavaPlugin.register_output(
|
2
|
-
:mysql, "org.embulk.output.MySQLOutputPlugin",
|
3
|
-
File.expand_path('../../../../classpath', __FILE__))
|
1
|
+
Embulk::JavaPlugin.register_output(
|
2
|
+
:mysql, "org.embulk.output.MySQLOutputPlugin",
|
3
|
+
File.expand_path('../../../../classpath', __FILE__))
|
@@ -1,36 +1,36 @@
|
|
1
|
-
package org.embulk.output.mysql;
|
2
|
-
|
3
|
-
import java.io.IOException;
|
4
|
-
import java.sql.Types;
|
5
|
-
import java.sql.PreparedStatement;
|
6
|
-
import java.sql.SQLException;
|
7
|
-
import org.embulk.output.jdbc.StandardBatchInsert;
|
8
|
-
|
9
|
-
public class MySQLBatchInsert
|
10
|
-
extends StandardBatchInsert
|
11
|
-
{
|
12
|
-
public MySQLBatchInsert(MySQLOutputConnector connector) throws IOException, SQLException
|
13
|
-
{
|
14
|
-
super(connector);
|
15
|
-
}
|
16
|
-
|
17
|
-
@Override
|
18
|
-
public void setFloat(float v) throws IOException, SQLException
|
19
|
-
{
|
20
|
-
if (Float.isNaN(v) || Float.isInfinite(v)) {
|
21
|
-
setNull(Types.REAL); // TODO get through argument
|
22
|
-
} else {
|
23
|
-
super.setFloat(v);
|
24
|
-
}
|
25
|
-
}
|
26
|
-
|
27
|
-
@Override
|
28
|
-
public void setDouble(double v) throws IOException, SQLException
|
29
|
-
{
|
30
|
-
if (Double.isNaN(v) || Double.isInfinite(v)) {
|
31
|
-
setNull(Types.DOUBLE); // TODO get through argument
|
32
|
-
} else {
|
33
|
-
super.setDouble(v);
|
34
|
-
}
|
35
|
-
}
|
36
|
-
}
|
1
|
+
package org.embulk.output.mysql;
|
2
|
+
|
3
|
+
import java.io.IOException;
|
4
|
+
import java.sql.Types;
|
5
|
+
import java.sql.PreparedStatement;
|
6
|
+
import java.sql.SQLException;
|
7
|
+
import org.embulk.output.jdbc.StandardBatchInsert;
|
8
|
+
|
9
|
+
public class MySQLBatchInsert
|
10
|
+
extends StandardBatchInsert
|
11
|
+
{
|
12
|
+
public MySQLBatchInsert(MySQLOutputConnector connector) throws IOException, SQLException
|
13
|
+
{
|
14
|
+
super(connector);
|
15
|
+
}
|
16
|
+
|
17
|
+
@Override
|
18
|
+
public void setFloat(float v) throws IOException, SQLException
|
19
|
+
{
|
20
|
+
if (Float.isNaN(v) || Float.isInfinite(v)) {
|
21
|
+
setNull(Types.REAL); // TODO get through argument
|
22
|
+
} else {
|
23
|
+
super.setFloat(v);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
@Override
|
28
|
+
public void setDouble(double v) throws IOException, SQLException
|
29
|
+
{
|
30
|
+
if (Double.isNaN(v) || Double.isInfinite(v)) {
|
31
|
+
setNull(Types.DOUBLE); // TODO get through argument
|
32
|
+
} else {
|
33
|
+
super.setDouble(v);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
@@ -1,42 +1,42 @@
|
|
1
|
-
package org.embulk.output.mysql;
|
2
|
-
|
3
|
-
import java.util.Properties;
|
4
|
-
import java.sql.Driver;
|
5
|
-
import java.sql.Connection;
|
6
|
-
import java.sql.SQLException;
|
7
|
-
import org.embulk.output.jdbc.JdbcOutputConnector;
|
8
|
-
import org.embulk.output.jdbc.JdbcOutputConnection;
|
9
|
-
|
10
|
-
public class MySQLOutputConnector
|
11
|
-
implements JdbcOutputConnector
|
12
|
-
{
|
13
|
-
private final Driver driver;
|
14
|
-
private final String url;
|
15
|
-
private final Properties properties;
|
16
|
-
|
17
|
-
public MySQLOutputConnector(String url, Properties properties)
|
18
|
-
{
|
19
|
-
try {
|
20
|
-
this.driver = new com.mysql.jdbc.Driver(); // new com.mysql.jdbc.Driver throws SQLException
|
21
|
-
} catch (SQLException ex) {
|
22
|
-
throw new RuntimeException(ex);
|
23
|
-
}
|
24
|
-
this.url = url;
|
25
|
-
this.properties = properties;
|
26
|
-
}
|
27
|
-
|
28
|
-
@Override
|
29
|
-
public MySQLOutputConnection connect(boolean autoCommit) throws SQLException
|
30
|
-
{
|
31
|
-
Connection c = driver.connect(url, properties);
|
32
|
-
try {
|
33
|
-
MySQLOutputConnection con = new MySQLOutputConnection(c, autoCommit);
|
34
|
-
c = null;
|
35
|
-
return con;
|
36
|
-
} finally {
|
37
|
-
if (c != null) {
|
38
|
-
c.close();
|
39
|
-
}
|
40
|
-
}
|
41
|
-
}
|
42
|
-
}
|
1
|
+
package org.embulk.output.mysql;
|
2
|
+
|
3
|
+
import java.util.Properties;
|
4
|
+
import java.sql.Driver;
|
5
|
+
import java.sql.Connection;
|
6
|
+
import java.sql.SQLException;
|
7
|
+
import org.embulk.output.jdbc.JdbcOutputConnector;
|
8
|
+
import org.embulk.output.jdbc.JdbcOutputConnection;
|
9
|
+
|
10
|
+
public class MySQLOutputConnector
|
11
|
+
implements JdbcOutputConnector
|
12
|
+
{
|
13
|
+
private final Driver driver;
|
14
|
+
private final String url;
|
15
|
+
private final Properties properties;
|
16
|
+
|
17
|
+
public MySQLOutputConnector(String url, Properties properties)
|
18
|
+
{
|
19
|
+
try {
|
20
|
+
this.driver = new com.mysql.jdbc.Driver(); // new com.mysql.jdbc.Driver throws SQLException
|
21
|
+
} catch (SQLException ex) {
|
22
|
+
throw new RuntimeException(ex);
|
23
|
+
}
|
24
|
+
this.url = url;
|
25
|
+
this.properties = properties;
|
26
|
+
}
|
27
|
+
|
28
|
+
@Override
|
29
|
+
public MySQLOutputConnection connect(boolean autoCommit) throws SQLException
|
30
|
+
{
|
31
|
+
Connection c = driver.connect(url, properties);
|
32
|
+
try {
|
33
|
+
MySQLOutputConnection con = new MySQLOutputConnection(c, autoCommit);
|
34
|
+
c = null;
|
35
|
+
return con;
|
36
|
+
} finally {
|
37
|
+
if (c != null) {
|
38
|
+
c.close();
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-output-mysql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
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-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Inserts or updates records to a table.
|
14
14
|
email:
|
@@ -25,8 +25,8 @@ files:
|
|
25
25
|
- src/main/java/org/embulk/output/mysql/MySQLBatchUpsert.java
|
26
26
|
- src/main/java/org/embulk/output/mysql/MySQLOutputConnection.java
|
27
27
|
- src/main/java/org/embulk/output/mysql/MySQLOutputConnector.java
|
28
|
-
- classpath/embulk-output-jdbc-0.2.
|
29
|
-
- classpath/embulk-output-mysql-0.2.
|
28
|
+
- classpath/embulk-output-jdbc-0.2.4.jar
|
29
|
+
- classpath/embulk-output-mysql-0.2.4.jar
|
30
30
|
- classpath/mysql-connector-java-5.1.34.jar
|
31
31
|
homepage: https://github.com/embulk/embulk-output-jdbc
|
32
32
|
licenses:
|