embulk-input-redshift 0.1.0
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 +7 -0
- data/README.md +42 -0
- data/build.gradle +6 -0
- data/classpath/embulk-input-jdbc-0.1.0.jar +0 -0
- data/classpath/embulk-input-postgresql-0.1.0.jar +0 -0
- data/classpath/embulk-input-redshift-0.1.0.jar +0 -0
- data/classpath/jna-4.1.0.jar +0 -0
- data/classpath/jna-platform-4.1.0.jar +0 -0
- data/classpath/postgresql-9.4-1200-jdbc41.jar +0 -0
- data/classpath/slf4j-simple-1.7.7.jar +0 -0
- data/classpath/waffle-jna-1.7.jar +0 -0
- data/lib/embulk/input/redshift.rb +3 -0
- data/src/main/java/org/embulk/input/RedshiftInputPlugin.java +61 -0
- metadata +56 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d6ecf6fa6da2d5d3a4d75a70b30034b872ae5faa
|
4
|
+
data.tar.gz: 753ed515bae22bbe5e1aebe551e7c9c97338677e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2a4e639b0f9016471ce9e1c17f0a8027ca8be7eb8e854441f23ec27cbe1d2744c6b8e2229d8f8e429e37d05fd2dc16e0e746e3f4e2942ac0c100e7af84010e5a
|
7
|
+
data.tar.gz: 619b3c4ef570a1cd9277c58fdb96387b1190ea0d5ed022ec469932952f485fb51d65130f757b3e552c864931c00a4d06435c9c4d3e4b8a0ffa6c8973bfa5d464
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Redshift input plugins for Embulk
|
2
|
+
|
3
|
+
Redshift input plugins for Embulk loads records from Redshift.
|
4
|
+
|
5
|
+
## Overview
|
6
|
+
|
7
|
+
* **Plugin type**: input
|
8
|
+
* **Resume supported**: yes
|
9
|
+
|
10
|
+
## Configuration
|
11
|
+
|
12
|
+
- **host**: database host name (string, required)
|
13
|
+
- **port**: database port number (integer, 5439)
|
14
|
+
- **user**: database login user name (string, required)
|
15
|
+
- **password**: database login password (string, default: "")
|
16
|
+
- **database**: destination database name (string, required)
|
17
|
+
- **schema**: destination name (string, default: "public")
|
18
|
+
- **table**: destination name (string, required)
|
19
|
+
- **select**: comma-separated list of columns to select (string, default: "*")
|
20
|
+
- **where**: WHERE condition to filter the rows (string, default: no-condition)
|
21
|
+
- **fetch_rows**: number of rows to fetch one time (used for java.sql.Statement#setFetchSize) (integer, default: 10000)
|
22
|
+
- **options**: extra JDBC properties (hash, default: {})
|
23
|
+
|
24
|
+
## Example
|
25
|
+
|
26
|
+
```yaml
|
27
|
+
in:
|
28
|
+
type: redshift
|
29
|
+
host: localhost
|
30
|
+
user: myuser
|
31
|
+
password: ""
|
32
|
+
database: my_database
|
33
|
+
table: my_table
|
34
|
+
select: "col1, col2, col3"
|
35
|
+
where: "col4 != 'a'"
|
36
|
+
```
|
37
|
+
|
38
|
+
## Build
|
39
|
+
|
40
|
+
```
|
41
|
+
$ ./gradlew gem
|
42
|
+
```
|
data/build.gradle
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,61 @@
|
|
1
|
+
package org.embulk.input;
|
2
|
+
|
3
|
+
import java.util.Properties;
|
4
|
+
import java.sql.Connection;
|
5
|
+
import java.sql.Driver;
|
6
|
+
import java.sql.SQLException;
|
7
|
+
import com.google.common.base.Throwables;
|
8
|
+
import org.embulk.config.Config;
|
9
|
+
import org.embulk.input.jdbc.AbstractJdbcInputPlugin;
|
10
|
+
import org.embulk.input.jdbc.AbstractJdbcInputPlugin;
|
11
|
+
import org.embulk.input.postgresql.PostgreSQLInputConnection;
|
12
|
+
|
13
|
+
public class RedshiftInputPlugin
|
14
|
+
extends AbstractJdbcInputPlugin
|
15
|
+
{
|
16
|
+
private static final String DEFAULT_SCHEMA = "public";
|
17
|
+
private static final int DEFAULT_PORT = 5439;
|
18
|
+
|
19
|
+
private static final Driver driver = new org.postgresql.Driver();
|
20
|
+
|
21
|
+
@Override
|
22
|
+
protected PostgreSQLInputConnection newConnection(PluginTask task) throws SQLException
|
23
|
+
{
|
24
|
+
String url = String.format("jdbc:postgresql://%s:%d/%s",
|
25
|
+
task.getHost(), task.getPort().or(DEFAULT_PORT), task.getDatabase());
|
26
|
+
|
27
|
+
Properties props = new Properties();
|
28
|
+
props.setProperty("user", task.getUser());
|
29
|
+
props.setProperty("password", task.getPassword());
|
30
|
+
props.setProperty("loginTimeout", "300"); // seconds
|
31
|
+
props.setProperty("socketTimeout", "1800"); // seconds
|
32
|
+
|
33
|
+
// Enable keepalive based on tcp_keepalive_time, tcp_keepalive_intvl and tcp_keepalive_probes kernel parameters.
|
34
|
+
// Socket options TCP_KEEPCNT, TCP_KEEPIDLE, and TCP_KEEPINTVL are not configurable.
|
35
|
+
props.setProperty("tcpKeepAlive", "true");
|
36
|
+
|
37
|
+
// TODO
|
38
|
+
//switch task.getSssl() {
|
39
|
+
//when "disable":
|
40
|
+
// break;
|
41
|
+
//when "enable":
|
42
|
+
// props.setProperty("sslfactory", "org.postgresql.ssl.NonValidatingFactory"); // disable server-side validation
|
43
|
+
//when "verify":
|
44
|
+
// props.setProperty("ssl", "true");
|
45
|
+
// break;
|
46
|
+
//}
|
47
|
+
|
48
|
+
props.putAll(task.getOptions());
|
49
|
+
|
50
|
+
Connection con = driver.connect(url, props);
|
51
|
+
try {
|
52
|
+
PostgreSQLInputConnection c = new PostgreSQLInputConnection(con, task.getSchema().or(DEFAULT_SCHEMA));
|
53
|
+
con = null;
|
54
|
+
return c;
|
55
|
+
} finally {
|
56
|
+
if (con != null) {
|
57
|
+
con.close();
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: embulk-input-redshift
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- FURUHASHI Sadayuki
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-16 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: JDBC input plugin is an Embulk plugin that loads records from JDBC so that any output plugins can receive the records. Search the output plugins by "embulk-output" keyword.
|
14
|
+
email:
|
15
|
+
- frsyuki@users.sourceforge.jp
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- README.md
|
21
|
+
- build.gradle
|
22
|
+
- lib/embulk/input/redshift.rb
|
23
|
+
- src/main/java/org/embulk/input/RedshiftInputPlugin.java
|
24
|
+
- classpath/embulk-input-jdbc-0.1.0.jar
|
25
|
+
- classpath/embulk-input-postgresql-0.1.0.jar
|
26
|
+
- classpath/embulk-input-redshift-0.1.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
|
32
|
+
homepage: https://github.com/embulk/embulk-input-jdbc
|
33
|
+
licenses:
|
34
|
+
- Apache 2.0
|
35
|
+
metadata: {}
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 2.1.9
|
53
|
+
signing_key:
|
54
|
+
specification_version: 4
|
55
|
+
summary: JDBC input plugin for Embulk
|
56
|
+
test_files: []
|