embulk-output-mysql 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 08ce3d7d01de2156f2abd94945de3150b720d02b
4
- data.tar.gz: ee6daf0fc1e53bca5c94819dd15859a1bfed4d9d
3
+ metadata.gz: 94635a7b141b413cc4e583e31036be36278321bd
4
+ data.tar.gz: cd69087a64a2f6182ba24b787defcbff9b95941d
5
5
  SHA512:
6
- metadata.gz: b2d2a6b452e17793b26860ca0e60b0b71b9267e7bec211d40e91044b221edc6661856b43cfa09208025c77708abce475adcaae5bf39d50a9f1ae2e7dc705ddc0
7
- data.tar.gz: bdc61bc8d920feed647c7ae8ac19200a7d1183e808a5c4cecaff3e48cb1984b56a5c42c0ba04d9253fd701cb7faea223fb366a7d120aca217d6a2bfb0831048d
6
+ metadata.gz: d50235ae89dfa0208e54c920728306745ba1f82d9ac5513fe56d925cd985f715b6811711bc442c81c91f4050c7df7ac0782db53f91f7e1525e66261fbea259fa
7
+ data.tar.gz: c54ef01b29c2472511676dc6cf185af0cf960396e0ee93e8556e687892a249d78e53c64e866eac62acd2efcc60d24fc549360994859fdd7d0cf65da2d7cba51f
data/README.md CHANGED
@@ -17,7 +17,7 @@ MySQL output plugins for Embulk loads records to MySQL.
17
17
  - **user**: database login user name (string, required)
18
18
  - **password**: database login password (string, default: "")
19
19
  - **database**: destination database name (string, required)
20
- - **table**: destination name (string, required)
20
+ - **table**: destination table name (string, required)
21
21
  - **mode**: "replace" or "insert" (string, required)
22
22
  - **batch_size**: size of a single batch insert (integer, default: 16777216)
23
23
  - **options**: extra connection properties (hash, default: {})
@@ -5,6 +5,8 @@ import java.io.IOException;
5
5
  import java.sql.SQLException;
6
6
  import java.sql.Connection;
7
7
  import org.embulk.spi.Exec;
8
+ import org.embulk.config.Config;
9
+ import org.embulk.config.ConfigDefault;
8
10
  import org.embulk.output.jdbc.AbstractJdbcOutputPlugin;
9
11
  import org.embulk.output.jdbc.JdbcOutputConnection;
10
12
  import org.embulk.output.jdbc.BatchInsert;
@@ -15,17 +17,44 @@ import org.embulk.output.mysql.MySQLBatchInsert;
15
17
  public class MySQLOutputPlugin
16
18
  extends AbstractJdbcOutputPlugin
17
19
  {
18
- private static final int DEFAULT_PORT = 3306;
20
+ public interface MySQLPluginTask
21
+ extends PluginTask
22
+ {
23
+ @Config("host")
24
+ public String getHost();
25
+
26
+ @Config("port")
27
+ @ConfigDefault("3306")
28
+ public int getPort();
29
+
30
+ @Config("user")
31
+ public String getUser();
32
+
33
+ @Config("password")
34
+ @ConfigDefault("\"\"")
35
+ public String getPassword();
36
+
37
+ @Config("database")
38
+ public String getDatabase();
39
+ }
40
+
41
+ @Override
42
+ protected Class<? extends PluginTask> getTaskClass()
43
+ {
44
+ return MySQLPluginTask.class;
45
+ }
19
46
 
20
47
  @Override
21
48
  protected MySQLOutputConnector getConnector(PluginTask task, boolean retryableMetadataOperation)
22
49
  {
50
+ MySQLPluginTask t = (MySQLPluginTask) task;
51
+
23
52
  String url = String.format("jdbc:mysql://%s:%d/%s",
24
- task.getHost(), task.getPort().or(DEFAULT_PORT), task.getDatabase());
53
+ t.getHost(), t.getPort(), t.getDatabase());
25
54
 
26
55
  Properties props = new Properties();
27
- props.setProperty("user", task.getUser());
28
- props.setProperty("password", task.getPassword());
56
+ props.setProperty("user", t.getUser());
57
+ props.setProperty("password", t.getPassword());
29
58
 
30
59
  props.setProperty("rewriteBatchedStatements", "true");
31
60
  props.setProperty("useCompression", "true");
@@ -38,7 +67,7 @@ public class MySQLOutputPlugin
38
67
  props.setProperty("tcpKeepAlive", "true");
39
68
 
40
69
  // TODO
41
- //switch task.getSssl() {
70
+ //switch t.getSssl() {
42
71
  //when "disable":
43
72
  // break;
44
73
  //when "enable":
@@ -59,7 +88,7 @@ public class MySQLOutputPlugin
59
88
  props.setProperty("socketTimeout", "2700000"); // milliseconds
60
89
  }
61
90
 
62
- props.putAll(task.getOptions());
91
+ props.putAll(t.getOptions());
63
92
 
64
93
  return new MySQLOutputConnector(url, props);
65
94
  }
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.1.2
4
+ version: 0.2.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-25 00:00:00.000000000 Z
11
+ date: 2015-02-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Inserts or updates records to a table.
14
14
  email:
@@ -24,8 +24,8 @@ files:
24
24
  - src/main/java/org/embulk/output/mysql/MySQLBatchInsert.java
25
25
  - src/main/java/org/embulk/output/mysql/MySQLOutputConnection.java
26
26
  - src/main/java/org/embulk/output/mysql/MySQLOutputConnector.java
27
- - classpath/embulk-output-jdbc-0.1.2.jar
28
- - classpath/embulk-output-mysql-0.1.2.jar
27
+ - classpath/embulk-output-jdbc-0.2.0.jar
28
+ - classpath/embulk-output-mysql-0.2.0.jar
29
29
  - classpath/mysql-connector-java-5.1.34.jar
30
30
  homepage: https://github.com/embulk/embulk-output-jdbc
31
31
  licenses: