embulk-input-redshift 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83c1b050f62024c8b6cf8628f45e35a2595f3e6d
4
- data.tar.gz: 8e1b161c9a439f538266af094faba0e4bc615de7
3
+ metadata.gz: 5e23d4e059b076fec9be77f77c9684131f840d90
4
+ data.tar.gz: 538f85b4803d2c3d1facebf992ad8e7548126a22
5
5
  SHA512:
6
- metadata.gz: 9e4a7e153e7a6ae651c5afc4de47dae2837af189638148db5a78b37fcfd7a5d334c5ff021012802ec734788f9e216e5f6f592283ab32eab991298988b577314e
7
- data.tar.gz: aac3cd36d281e8ec783e1e4e4f07c8d2a3321edd436af4c05570792c95d0c7f0b21da918e6bf76e789c32ba56b7b968301dfb6846c8fa1488e36acf23d3df1b9
6
+ metadata.gz: 3d70ccf9d99d91adfc82efde03b5878fc27cde539679816fda50ba9bd32e4453c9fcf72c0e2cb45592728ff5ad5a908d981a01b348df3e0754d8d515a6d949df
7
+ data.tar.gz: 7f195f9acd815f07680ff2ebfd81ede4f56b95368da0cf0a242483bc631fae585e83e15aaef0eef8fcaea6b23ab06fa53334158c7c025da86ab72b0d21d27c6a
data/README.md CHANGED
@@ -14,8 +14,8 @@ Redshift input plugins for Embulk loads records from Redshift.
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
- - **schema**: destination name (string, default: "public")
18
- - **table**: destination name (string, required)
17
+ - **schema**: destination schema name (string, default: "public")
18
+ - **table**: destination table name (string, required)
19
19
  - **select**: comma-separated list of columns to select (string, default: "*")
20
20
  - **where**: WHERE condition to filter the rows (string, default: no-condition)
21
21
  - **fetch_rows**: number of rows to fetch one time (used for java.sql.Statement#setFetchSize) (integer, default: 10000)
@@ -6,6 +6,7 @@ import java.sql.Driver;
6
6
  import java.sql.SQLException;
7
7
  import com.google.common.base.Throwables;
8
8
  import org.embulk.config.Config;
9
+ import org.embulk.config.ConfigDefault;
9
10
  import org.embulk.input.jdbc.AbstractJdbcInputPlugin;
10
11
  import org.embulk.input.jdbc.AbstractJdbcInputPlugin;
11
12
  import org.embulk.input.postgresql.PostgreSQLInputConnection;
@@ -13,20 +14,50 @@ import org.embulk.input.postgresql.PostgreSQLInputConnection;
13
14
  public class RedshiftInputPlugin
14
15
  extends AbstractJdbcInputPlugin
15
16
  {
16
- private static final String DEFAULT_SCHEMA = "public";
17
- private static final int DEFAULT_PORT = 5439;
18
-
19
17
  private static final Driver driver = new org.postgresql.Driver();
20
18
 
19
+ public interface RedshiftPluginTask
20
+ extends PluginTask
21
+ {
22
+ @Config("host")
23
+ public String getHost();
24
+
25
+ @Config("port")
26
+ @ConfigDefault("5439")
27
+ public int getPort();
28
+
29
+ @Config("user")
30
+ public String getUser();
31
+
32
+ @Config("password")
33
+ @ConfigDefault("\"\"")
34
+ public String getPassword();
35
+
36
+ @Config("database")
37
+ public String getDatabase();
38
+
39
+ @Config("schema")
40
+ @ConfigDefault("\"public\"")
41
+ public String getSchema();
42
+ }
43
+
44
+ @Override
45
+ protected Class<? extends PluginTask> getTaskClass()
46
+ {
47
+ return RedshiftPluginTask.class;
48
+ }
49
+
21
50
  @Override
22
51
  protected PostgreSQLInputConnection newConnection(PluginTask task) throws SQLException
23
52
  {
53
+ RedshiftPluginTask t = (RedshiftPluginTask) task;
54
+
24
55
  String url = String.format("jdbc:postgresql://%s:%d/%s",
25
- task.getHost(), task.getPort().or(DEFAULT_PORT), task.getDatabase());
56
+ t.getHost(), t.getPort(), t.getDatabase());
26
57
 
27
58
  Properties props = new Properties();
28
- props.setProperty("user", task.getUser());
29
- props.setProperty("password", task.getPassword());
59
+ props.setProperty("user", t.getUser());
60
+ props.setProperty("password", t.getPassword());
30
61
  props.setProperty("loginTimeout", "300"); // seconds
31
62
  props.setProperty("socketTimeout", "1800"); // seconds
32
63
 
@@ -35,7 +66,7 @@ public class RedshiftInputPlugin
35
66
  props.setProperty("tcpKeepAlive", "true");
36
67
 
37
68
  // TODO
38
- //switch task.getSssl() {
69
+ //switch t.getSssl() {
39
70
  //when "disable":
40
71
  // break;
41
72
  //when "enable":
@@ -45,11 +76,11 @@ public class RedshiftInputPlugin
45
76
  // break;
46
77
  //}
47
78
 
48
- props.putAll(task.getOptions());
79
+ props.putAll(t.getOptions());
49
80
 
50
81
  Connection con = driver.connect(url, props);
51
82
  try {
52
- PostgreSQLInputConnection c = new PostgreSQLInputConnection(con, task.getSchema().or(DEFAULT_SCHEMA));
83
+ PostgreSQLInputConnection c = new PostgreSQLInputConnection(con, t.getSchema());
53
84
  con = null;
54
85
  return c;
55
86
  } finally {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-redshift
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
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-25 00:00:00.000000000 Z
11
+ date: 2015-02-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Selects records from a table.
14
14
  email:
@@ -21,9 +21,9 @@ files:
21
21
  - build.gradle
22
22
  - lib/embulk/input/redshift.rb
23
23
  - src/main/java/org/embulk/input/RedshiftInputPlugin.java
24
- - classpath/embulk-input-jdbc-0.2.3.jar
25
- - classpath/embulk-input-postgresql-0.2.3.jar
26
- - classpath/embulk-input-redshift-0.2.3.jar
24
+ - classpath/embulk-input-jdbc-0.3.0.jar
25
+ - classpath/embulk-input-postgresql-0.3.0.jar
26
+ - classpath/embulk-input-redshift-0.3.0.jar
27
27
  - classpath/jna-4.1.0.jar
28
28
  - classpath/jna-platform-4.1.0.jar
29
29
  - classpath/postgresql-9.4-1200-jdbc41.jar