embulk-input-postgresql 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ad82d4d16fa9bf71b1be8622ded6302988b4131
4
- data.tar.gz: 914aa9860e0c3bd21d1cd29049efde0654603ab2
3
+ metadata.gz: 7fb030ef14fd1af1463a2b3b3cdd83bf512c1c7d
4
+ data.tar.gz: 37457bed77da7e3af7186587e940186bbb2e56e7
5
5
  SHA512:
6
- metadata.gz: 930e786df74790257795ca6b54b90e46dc48bdc19da8762ea48947e3c5734d63a55c577c28aed7a98689bb0ee390005b8e3d1f1b835af97c10f0ff3b4c97ac65
7
- data.tar.gz: 6007e52be0adab347502bffc569b55ec3cbe63f29a71097ffd4981c72ab41c2827e2d2e0d419f4ffe08497b1de8e3b366ed3679667c5edd5f968755732722a7e
6
+ metadata.gz: 240f99990ea0af0d82f7ef2299643d4cafe32a47fbdf3cacc88e3b1f6d2476d74a8042a4a78b88c3b6bb33a45ceb7a397dd1a6eb1d0284454bd55476f4fcd731
7
+ data.tar.gz: 630d0aa5ad64dbb9954cee5cd52567d2451be1d02a2665fd7d24264098d5fc47b38deb6f691513b5ab077be44e487996a6eef29aecd5d98bdb31d990cf6a4483
data/README.md CHANGED
@@ -16,6 +16,9 @@ PostgreSQL input plugins for Embulk loads records from PostgreSQL.
16
16
  - **database**: destination database name (string, required)
17
17
  - **schema**: destination schema name (string, default: "public")
18
18
  - **fetch_rows**: number of rows to fetch one time (used for java.sql.Statement#setFetchSize) (integer, default: 10000)
19
+ - **connect_timeout**: timeout for establishment of a database connection. (integer (seconds), default: 300)
20
+ - **socket_timeout**: timeout for socket read operations. 0 means no timeout. (integer (seconds), default: 1800)
21
+ - **ssl**: enables SSL. data will be encrypted but CA or certification will not be verified (boolean, default: false)
19
22
  - **options**: extra JDBC properties (hash, default: {})
20
23
  - If you write SQL directly,
21
24
  - **query**: SQL to run (string)
data/build.gradle CHANGED
@@ -1,7 +1,7 @@
1
1
  dependencies {
2
2
  compile project(':embulk-input-jdbc')
3
3
 
4
- compile 'org.postgresql:postgresql:9.4-1200-jdbc41'
4
+ compile 'org.postgresql:postgresql:9.4-1205-jdbc41'
5
5
 
6
6
  testCompile project(':embulk-input-jdbc').sourceSets.test.output
7
7
  }
@@ -4,7 +4,6 @@ import java.util.Properties;
4
4
  import java.sql.Connection;
5
5
  import java.sql.Driver;
6
6
  import java.sql.SQLException;
7
- import com.google.common.base.Throwables;
8
7
  import org.embulk.config.Config;
9
8
  import org.embulk.config.ConfigDefault;
10
9
  import org.embulk.input.jdbc.AbstractJdbcInputPlugin;
@@ -38,6 +37,10 @@ public class PostgreSQLInputPlugin
38
37
  @Config("schema")
39
38
  @ConfigDefault("\"public\"")
40
39
  public String getSchema();
40
+
41
+ @Config("ssl")
42
+ @ConfigDefault("false")
43
+ public boolean getSsl();
41
44
  }
42
45
 
43
46
  @Override
@@ -57,23 +60,20 @@ public class PostgreSQLInputPlugin
57
60
  Properties props = new Properties();
58
61
  props.setProperty("user", t.getUser());
59
62
  props.setProperty("password", t.getPassword());
60
- props.setProperty("loginTimeout", "300"); // seconds
61
- props.setProperty("socketTimeout", "1800"); // seconds
63
+ props.setProperty("loginTimeout", String.valueOf(t.getConnectTimeout())); // seconds
64
+ props.setProperty("socketTimeout", String.valueOf(t.getSocketTimeout())); // seconds
62
65
 
63
66
  // Enable keepalive based on tcp_keepalive_time, tcp_keepalive_intvl and tcp_keepalive_probes kernel parameters.
64
67
  // Socket options TCP_KEEPCNT, TCP_KEEPIDLE, and TCP_KEEPINTVL are not configurable.
65
68
  props.setProperty("tcpKeepAlive", "true");
66
69
 
67
- // TODO
68
- //switch t.getSssl() {
69
- //when "disable":
70
- // break;
71
- //when "enable":
72
- // props.setProperty("sslfactory", "org.postgresql.ssl.NonValidatingFactory"); // disable server-side validation
73
- //when "verify":
74
- // props.setProperty("ssl", "true");
75
- // break;
76
- //}
70
+ if (t.getSsl()) {
71
+ // TODO add ssl_verify (boolean) option to allow users to verify certification.
72
+ // see embulk-input-ftp for SSL implementation.
73
+ props.setProperty("ssl", "true");
74
+ props.setProperty("sslfactory", "org.postgresql.ssl.NonValidatingFactory"); // disable server-side validation
75
+ }
76
+ // setting ssl=false enables SSL. See org.postgresql.core.v3.openConnectionImpl.
77
77
 
78
78
  props.putAll(t.getOptions());
79
79
 
@@ -20,11 +20,12 @@ public class PostgreSQLInputConnection
20
20
  }
21
21
 
22
22
  @Override
23
- protected CursorSelect newBatchSelect(String select, int fetchRows) throws SQLException
23
+ protected CursorSelect newBatchSelect(String select, int fetchRows, int queryTimeout) throws SQLException
24
24
  {
25
25
  executeUpdate("DECLARE cur NO SCROLL CURSOR FOR "+select);
26
26
 
27
27
  String fetchSql = "FETCH FORWARD "+fetchRows+" FROM cur";
28
+ // Because socketTimeout is set in Connection, don't need to set quertyTimeout.
28
29
  return new CursorSelect(fetchSql, connection.prepareStatement(fetchSql));
29
30
  }
30
31
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-postgresql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
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-07-07 00:00:00.000000000 Z
11
+ date: 2015-12-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Selects records from a table.
14
14
  email:
@@ -22,13 +22,9 @@ files:
22
22
  - lib/embulk/input/postgresql.rb
23
23
  - src/main/java/org/embulk/input/PostgreSQLInputPlugin.java
24
24
  - src/main/java/org/embulk/input/postgresql/PostgreSQLInputConnection.java
25
- - classpath/embulk-input-jdbc-0.6.0.jar
26
- - classpath/embulk-input-postgresql-0.6.0.jar
27
- - classpath/jna-4.1.0.jar
28
- - classpath/jna-platform-4.1.0.jar
29
- - classpath/postgresql-9.4-1200-jdbc41.jar
30
- - classpath/slf4j-simple-1.7.7.jar
31
- - classpath/waffle-jna-1.7.jar
25
+ - classpath/embulk-input-jdbc-0.6.1.jar
26
+ - classpath/embulk-input-postgresql-0.6.1.jar
27
+ - classpath/postgresql-9.4-1205-jdbc41.jar
32
28
  homepage: https://github.com/embulk/embulk-input-jdbc
33
29
  licenses:
34
30
  - Apache 2.0
Binary file
Binary file
Binary file
Binary file