embulk-output-postgresql 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 +4 -4
- data/README.md +2 -2
- data/classpath/embulk-output-jdbc-0.2.0.jar +0 -0
- data/classpath/{embulk-output-postgresql-0.1.2.jar → embulk-output-postgresql-0.2.0.jar} +0 -0
- data/src/main/java/org/embulk/output/PostgreSQLOutputPlugin.java +40 -8
- metadata +4 -4
- data/classpath/embulk-output-jdbc-0.1.2.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: 44ed8f4fbfa78610945b3a91df855c01aee5eb14
|
4
|
+
data.tar.gz: f096069f258e0af4f594bdacb50e856531603bbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55d89c919eca26b1dea9d751ecd12d7fae11dc45705a870e970d39b686f8f0f51c7c8e53b20be29adf9b8ab230d73701908c0b4e2d2d6be732a27f52738db21d
|
7
|
+
data.tar.gz: 6c976a45528ead54877092bbe39a568ef35e29e8e1209959861ae2b587f6212e22b9ea031bcf504bd62a74fc17c5fb787edd7739e73698ab914f0e12d03932f4
|
data/README.md
CHANGED
@@ -17,8 +17,8 @@ PostgreSQL output plugins for Embulk loads records to PostgreSQL.
|
|
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
|
-
- **schema**: destination name (string, default: "public")
|
21
|
-
- **table**: destination name (string, required)
|
20
|
+
- **schema**: destination schema name (string, default: "public")
|
21
|
+
- **table**: destination table name (string, required)
|
22
22
|
- **mode**: "replace" or "insert" (string, required)
|
23
23
|
- **batch_size**: size of a single batch insert (integer, default: 16777216)
|
24
24
|
- **options**: extra connection properties (hash, default: {})
|
Binary file
|
Binary file
|
@@ -4,6 +4,8 @@ import java.util.Properties;
|
|
4
4
|
import java.io.IOException;
|
5
5
|
import java.sql.SQLException;
|
6
6
|
import org.embulk.spi.Exec;
|
7
|
+
import org.embulk.config.Config;
|
8
|
+
import org.embulk.config.ConfigDefault;
|
7
9
|
import org.embulk.output.jdbc.AbstractJdbcOutputPlugin;
|
8
10
|
import org.embulk.output.jdbc.BatchInsert;
|
9
11
|
import org.embulk.output.postgresql.PostgreSQLOutputConnector;
|
@@ -12,18 +14,48 @@ import org.embulk.output.postgresql.PostgreSQLCopyBatchInsert;
|
|
12
14
|
public class PostgreSQLOutputPlugin
|
13
15
|
extends AbstractJdbcOutputPlugin
|
14
16
|
{
|
15
|
-
|
16
|
-
|
17
|
+
public interface PostgreSQLPluginTask
|
18
|
+
extends PluginTask
|
19
|
+
{
|
20
|
+
@Config("host")
|
21
|
+
public String getHost();
|
22
|
+
|
23
|
+
@Config("port")
|
24
|
+
@ConfigDefault("5432")
|
25
|
+
public int getPort();
|
26
|
+
|
27
|
+
@Config("user")
|
28
|
+
public String getUser();
|
29
|
+
|
30
|
+
@Config("password")
|
31
|
+
@ConfigDefault("\"\"")
|
32
|
+
public String getPassword();
|
33
|
+
|
34
|
+
@Config("database")
|
35
|
+
public String getDatabase();
|
36
|
+
|
37
|
+
@Config("schema")
|
38
|
+
@ConfigDefault("\"public\"")
|
39
|
+
public String getSchema();
|
40
|
+
}
|
41
|
+
|
42
|
+
@Override
|
43
|
+
protected Class<? extends PluginTask> getTaskClass()
|
44
|
+
{
|
45
|
+
return PostgreSQLPluginTask.class;
|
46
|
+
}
|
17
47
|
|
18
48
|
@Override
|
19
49
|
protected PostgreSQLOutputConnector getConnector(PluginTask task, boolean retryableMetadataOperation)
|
20
50
|
{
|
51
|
+
PostgreSQLPluginTask t = (PostgreSQLPluginTask) task;
|
52
|
+
|
21
53
|
String url = String.format("jdbc:postgresql://%s:%d/%s",
|
22
|
-
|
54
|
+
t.getHost(), t.getPort(), t.getDatabase());
|
23
55
|
|
24
56
|
Properties props = new Properties();
|
25
|
-
props.setProperty("user",
|
26
|
-
props.setProperty("password",
|
57
|
+
props.setProperty("user", t.getUser());
|
58
|
+
props.setProperty("password", t.getPassword());
|
27
59
|
props.setProperty("loginTimeout", "300"); // seconds
|
28
60
|
props.setProperty("socketTimeout", "1800"); // seconds
|
29
61
|
|
@@ -32,7 +64,7 @@ public class PostgreSQLOutputPlugin
|
|
32
64
|
props.setProperty("tcpKeepAlive", "true");
|
33
65
|
|
34
66
|
// TODO
|
35
|
-
//switch
|
67
|
+
//switch t.getSssl() {
|
36
68
|
//when "disable":
|
37
69
|
// break;
|
38
70
|
//when "enable":
|
@@ -48,9 +80,9 @@ public class PostgreSQLOutputPlugin
|
|
48
80
|
props.setProperty("socketTimeout", "28800"); // seconds
|
49
81
|
}
|
50
82
|
|
51
|
-
props.putAll(
|
83
|
+
props.putAll(t.getOptions());
|
52
84
|
|
53
|
-
return new PostgreSQLOutputConnector(url, props,
|
85
|
+
return new PostgreSQLOutputConnector(url, props, t.getSchema());
|
54
86
|
}
|
55
87
|
|
56
88
|
@Override
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-output-postgresql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
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-
|
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:
|
@@ -25,8 +25,8 @@ files:
|
|
25
25
|
- src/main/java/org/embulk/output/postgresql/PostgreSQLCopyBatchInsert.java
|
26
26
|
- src/main/java/org/embulk/output/postgresql/PostgreSQLOutputConnection.java
|
27
27
|
- src/main/java/org/embulk/output/postgresql/PostgreSQLOutputConnector.java
|
28
|
-
- classpath/embulk-output-jdbc-0.
|
29
|
-
- classpath/embulk-output-postgresql-0.
|
28
|
+
- classpath/embulk-output-jdbc-0.2.0.jar
|
29
|
+
- classpath/embulk-output-postgresql-0.2.0.jar
|
30
30
|
- classpath/jna-4.1.0.jar
|
31
31
|
- classpath/jna-platform-4.1.0.jar
|
32
32
|
- classpath/postgresql-9.4-1200-jdbc41.jar
|
Binary file
|