embulk-input-vertica 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 84ccf7962b2423d77edc6dcef723742cbcc985ef
4
+ data.tar.gz: 227baafc67c6ffd63061589bb1297fe3270c0655
5
+ SHA512:
6
+ metadata.gz: e840f624899f88c26d8855660841080c40105856148b4d456281978d2550f336f6ac28e5cc9b2bfdffc1af54369c7a9251a61314fea7649b7ad9050332a731aa
7
+ data.tar.gz: 7f81375fc1e398a2057e04087d9d6b47bd50688796da74c0264b14550fbcad012a56d2463de33c9dea935d2b3d110934ed1d0d6c1a8aadf9b35554db70f9b0c0
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ *~
2
+ /pkg/
3
+ /tmp/
4
+ *.gemspec
5
+ .gradle/
6
+ /classpath/
7
+ build/
8
+ .idea
9
+ *.csv
10
+ .tags
11
+ .ruby-version
12
+ example2
data/COPYING ADDED
@@ -0,0 +1,15 @@
1
+ Copyright (C) 2016 Naotoshi Seo
2
+ Copyright (C) 2015 Sadayuki Furuhashi
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
data/README.md ADDED
@@ -0,0 +1,121 @@
1
+ # Vertica input plugins for Embulk
2
+
3
+ Vertica input plugins for Embulk loads records from vertica.
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, 5432)
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 schema name (string, default: "public")
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)
22
+ - **options**: extra JDBC properties (hash, default: {})
23
+ - If you write SQL directly,
24
+ - **query**: SQL to run (string)
25
+ - If **query** is not set,
26
+ - **table**: destination table name (string, required)
27
+ - **select**: comma-separated list of columns to select (string, default: "*")
28
+ - **where**: WHERE condition to filter the rows (string, default: no-condition)
29
+ - **default_timezone**: If the sql type of a column is `date`/`time`/`datetime` and the embulk type is `string`, column values are formatted int this default_timezone. You can overwrite timezone for each columns using column_options option. (string, default: `UTC`)
30
+ - **column_options**: advanced: a key-value pairs where key is a column name and value is options for the column.
31
+ - **value_type**: embulk get values from database as this value_type. Typically, the value_type determines `getXXX` method of `java.sql.PreparedStatement`.
32
+ (string, default: depends on the sql type of the column. Available values options are: `long`, `double`, `float`, `decimal`, `boolean`, `string`, `date`, `time`, `timestamp`)
33
+ - **type**: Column values are converted to this embulk type.
34
+ Available values options are: `boolean`, `long`, `double`, `string`, `timestamp`).
35
+ By default, the embulk type is determined according to the sql type of the column (or value_type if specified).
36
+ - **timestamp_format**: If the sql type of the column is `date`/`time`/`datetime` and the embulk type is `string`, column values are formatted by this timestamp_format. And if the embulk type is `timestamp`, this timestamp_format may be used in the output plugin. For example, stdout plugin use the timestamp_format, but *csv formatter plugin doesn't use*. (string, default : `%Y-%m-%d` for `date`, `%H:%M:%S` for `time`, `%Y-%m-%d %H:%M:%S` for `timestamp`)
37
+ - **timezone**: If the sql type of the column is `date`/`time`/`datetime` and the embulk type is `string`, column values are formatted in this timezone.
38
+ (string, value of default_timezone option is used by default)
39
+
40
+ ## Example
41
+
42
+ ```yaml
43
+ in:
44
+ type: vertica
45
+ host: localhost
46
+ user: myuser
47
+ password: ""
48
+ database: my_database
49
+ schema: sandbox
50
+ table: my_table
51
+ select: "col1, col2, col3"
52
+ where: "col4 != 'a'"
53
+ ```
54
+
55
+ If you need a complex SQL,
56
+
57
+ ```yaml
58
+ in:
59
+ type: vertica
60
+ host: localhost
61
+ user: myuser
62
+ password: ""
63
+ database: my_database
64
+ query: |
65
+ SELECT t1.id, t1.name, t2.id AS t2_id, t2.name AS t2_name
66
+ FROM schema1.table1 AS t1
67
+ LEFT JOIN table2 AS t2
68
+ ON t1.id = t2.t1_id
69
+ ```
70
+
71
+ Advanced configuration:
72
+
73
+ ```yaml
74
+ in:
75
+ type: vertica
76
+ host: localhost
77
+ user: myuser
78
+ password: ""
79
+ database: my_database
80
+ schema: sandbox
81
+ table: "my_table"
82
+ select: "col1, col2, col3"
83
+ where: "col4 != 'a'"
84
+ column_options:
85
+ col1: {type: long}
86
+ col3: {type: string, timestamp_format: "%Y/%m/%d", timezone: "+0900"}
87
+
88
+ ```
89
+
90
+ ## LICENSE
91
+
92
+ See [./COPYING](COPYING)
93
+
94
+ Note that vertica jdbc drivers are not licensed under the Apace License, 2.0. It follows [Vertica Community Edition HP Software License Agreement](https://my.vertica.com/software-license-agreement/)
95
+
96
+ ## Development
97
+
98
+ Run example:
99
+
100
+ ```
101
+ $ ./gradlew classpath
102
+ $ embulk run -I lib example/example.yml
103
+ ```
104
+
105
+ Run test:
106
+
107
+ ```
108
+ $ ./gradlew test
109
+ ```
110
+
111
+ Run checkstyle:
112
+
113
+ ```
114
+ $ ./gradlew check
115
+ ```
116
+
117
+ Release gem:
118
+
119
+ ```
120
+ $ ./gradlew gemPush
121
+ ```
data/build.gradle ADDED
@@ -0,0 +1,100 @@
1
+ plugins {
2
+ id "com.jfrog.bintray" version "1.1"
3
+ id "com.github.jruby-gradle.base" version "0.1.5"
4
+ id "java"
5
+ id "checkstyle"
6
+ }
7
+ import com.github.jrubygradle.JRubyExec
8
+ repositories {
9
+ mavenCentral()
10
+ jcenter()
11
+ maven {
12
+ url "http://dl.bintray.com/embulk-input-jdbc/maven"
13
+ }
14
+ }
15
+ configurations {
16
+ provided
17
+ }
18
+
19
+ version = "0.1.0"
20
+
21
+ sourceCompatibility = 1.7
22
+ targetCompatibility = 1.7
23
+
24
+ dependencies {
25
+ compile "org.embulk:embulk-core:0.8.2"
26
+ provided "org.embulk:embulk-core:0.8.2"
27
+ testCompile "junit:junit:4.+"
28
+
29
+ compile "org.embulk.input.jdbc:embulk-input-jdbc:0.6.4"
30
+ compile files('lib/vertica-jdbc-7.0.1-0.jar')
31
+ // compile files('lib/vertica-jdbc-7.2.1-0.jar')
32
+ }
33
+
34
+ task classpath(type: Copy, dependsOn: ["jar"]) {
35
+ doFirst { file("classpath").deleteDir() }
36
+ from (configurations.runtime - configurations.provided + files(jar.archivePath))
37
+ into "classpath"
38
+ }
39
+ clean { delete "classpath" }
40
+
41
+ checkstyle {
42
+ configFile = file("${project.rootDir}/config/checkstyle/checkstyle.xml")
43
+ toolVersion = '6.14.1'
44
+ }
45
+ checkstyleMain {
46
+ configFile = file("${project.rootDir}/config/checkstyle/default.xml")
47
+ ignoreFailures = true
48
+ }
49
+ checkstyleTest {
50
+ configFile = file("${project.rootDir}/config/checkstyle/default.xml")
51
+ ignoreFailures = true
52
+ }
53
+ task checkstyle(type: Checkstyle) {
54
+ classpath = sourceSets.main.output + sourceSets.test.output
55
+ source = sourceSets.main.allJava + sourceSets.test.allJava
56
+ }
57
+
58
+ task gem(type: JRubyExec, dependsOn: ["gemspec", "classpath"]) {
59
+ jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "build"
60
+ script "${project.name}.gemspec"
61
+ doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
62
+ }
63
+
64
+ task gemPush(type: JRubyExec, dependsOn: ["gem"]) {
65
+ jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "push"
66
+ script "pkg/${project.name}-${project.version}.gem"
67
+ }
68
+
69
+ task "package"(dependsOn: ["gemspec", "classpath"]) << {
70
+ println "> Build succeeded."
71
+ println "> You can run embulk with '-L ${file(".").absolutePath}' argument."
72
+ }
73
+
74
+ task gemspec {
75
+ ext.gemspecFile = file("${project.name}.gemspec")
76
+ inputs.file "build.gradle"
77
+ outputs.file gemspecFile
78
+ doLast { gemspecFile.write($/
79
+ Gem::Specification.new do |spec|
80
+ spec.name = "${project.name}"
81
+ spec.version = "${project.version}"
82
+ spec.authors = ["sonots"]
83
+ spec.summary = %[Vertica input plugin for Embulk]
84
+ spec.description = %[Loads records from Vertica.]
85
+ spec.email = ["sonots@gmail.com"]
86
+ spec.licenses = ["MIT"]
87
+ spec.homepage = "https://github.com/sonots/embulk-input-vertica"
88
+
89
+ spec.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"]
90
+ spec.test_files = spec.files.grep(%r"^(test|spec)/")
91
+ spec.require_paths = ["lib"]
92
+
93
+ #spec.add_dependency 'YOUR_GEM_DEPENDENCY', ['~> YOUR_GEM_DEPENDENCY_VERSION']
94
+ spec.add_development_dependency 'bundler', ['~> 1.0']
95
+ spec.add_development_dependency 'rake', ['>= 10.0']
96
+ end
97
+ /$)
98
+ }
99
+ }
100
+ clean { delete "${project.name}.gemspec" }
@@ -0,0 +1,128 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE module PUBLIC
3
+ "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
4
+ "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
5
+ <module name="Checker">
6
+ <!-- https://github.com/facebook/presto/blob/master/src/checkstyle/checks.xml -->
7
+ <module name="FileTabCharacter"/>
8
+ <module name="NewlineAtEndOfFile">
9
+ <property name="lineSeparator" value="lf"/>
10
+ </module>
11
+ <module name="RegexpMultiline">
12
+ <property name="format" value="\r"/>
13
+ <property name="message" value="Line contains carriage return"/>
14
+ </module>
15
+ <module name="RegexpMultiline">
16
+ <property name="format" value=" \n"/>
17
+ <property name="message" value="Line has trailing whitespace"/>
18
+ </module>
19
+ <module name="RegexpMultiline">
20
+ <property name="format" value="\{\n\n"/>
21
+ <property name="message" value="Blank line after opening brace"/>
22
+ </module>
23
+ <module name="RegexpMultiline">
24
+ <property name="format" value="\n\n\s*\}"/>
25
+ <property name="message" value="Blank line before closing brace"/>
26
+ </module>
27
+ <module name="RegexpMultiline">
28
+ <property name="format" value="\n\n\n"/>
29
+ <property name="message" value="Multiple consecutive blank lines"/>
30
+ </module>
31
+ <module name="RegexpMultiline">
32
+ <property name="format" value="\n\n\Z"/>
33
+ <property name="message" value="Blank line before end of file"/>
34
+ </module>
35
+ <module name="RegexpMultiline">
36
+ <property name="format" value="Preconditions\.checkNotNull"/>
37
+ <property name="message" value="Use of checkNotNull"/>
38
+ </module>
39
+
40
+ <module name="TreeWalker">
41
+ <module name="EmptyBlock">
42
+ <property name="option" value="text"/>
43
+ <property name="tokens" value="
44
+ LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF,
45
+ LITERAL_FOR, LITERAL_TRY, LITERAL_WHILE, INSTANCE_INIT, STATIC_INIT"/>
46
+ </module>
47
+ <module name="EmptyStatement"/>
48
+ <module name="EmptyForInitializerPad"/>
49
+ <module name="EmptyForIteratorPad">
50
+ <property name="option" value="space"/>
51
+ </module>
52
+ <module name="MethodParamPad">
53
+ <property name="allowLineBreaks" value="true"/>
54
+ <property name="option" value="nospace"/>
55
+ </module>
56
+ <module name="ParenPad"/>
57
+ <module name="TypecastParenPad"/>
58
+ <module name="NeedBraces"/>
59
+ <module name="LeftCurly">
60
+ <property name="option" value="nl"/>
61
+ <property name="tokens" value="CLASS_DEF, CTOR_DEF, INTERFACE_DEF, METHOD_DEF"/>
62
+ </module>
63
+ <module name="LeftCurly">
64
+ <property name="option" value="eol"/>
65
+ <property name="tokens" value="
66
+ LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR,
67
+ LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE"/>
68
+ </module>
69
+ <module name="RightCurly">
70
+ <property name="option" value="alone"/>
71
+ </module>
72
+ <module name="GenericWhitespace"/>
73
+ <module name="WhitespaceAfter"/>
74
+ <module name="NoWhitespaceBefore"/>
75
+
76
+ <module name="UpperEll"/>
77
+ <module name="DefaultComesLast"/>
78
+ <module name="ArrayTypeStyle"/>
79
+ <module name="MultipleVariableDeclarations"/>
80
+ <module name="ModifierOrder"/>
81
+ <module name="OneStatementPerLine"/>
82
+ <module name="StringLiteralEquality"/>
83
+ <module name="MutableException"/>
84
+ <module name="EqualsHashCode"/>
85
+ <module name="InnerAssignment"/>
86
+ <module name="InterfaceIsType"/>
87
+ <module name="HideUtilityClassConstructor"/>
88
+
89
+ <module name="MemberName"/>
90
+ <module name="LocalVariableName"/>
91
+ <module name="LocalFinalVariableName"/>
92
+ <module name="TypeName"/>
93
+ <module name="PackageName"/>
94
+ <module name="ParameterName"/>
95
+ <module name="StaticVariableName"/>
96
+ <module name="ClassTypeParameterName">
97
+ <property name="format" value="^[A-Z][0-9]?$"/>
98
+ </module>
99
+ <module name="MethodTypeParameterName">
100
+ <property name="format" value="^[A-Z][0-9]?$"/>
101
+ </module>
102
+
103
+ <module name="AvoidStarImport"/>
104
+ <module name="RedundantImport"/>
105
+ <module name="UnusedImports"/>
106
+ <module name="ImportOrder">
107
+ <property name="groups" value="*,javax,java"/>
108
+ <property name="separated" value="true"/>
109
+ <property name="option" value="bottom"/>
110
+ <property name="sortStaticImportsAlphabetically" value="true"/>
111
+ </module>
112
+
113
+ <module name="WhitespaceAround">
114
+ <property name="allowEmptyConstructors" value="true"/>
115
+ <property name="allowEmptyMethods" value="true"/>
116
+ <property name="ignoreEnhancedForColon" value="false"/>
117
+ <property name="tokens" value="
118
+ ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN,
119
+ BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LE,
120
+ LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE,
121
+ LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN,
122
+ LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE,
123
+ LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL,
124
+ PLUS, PLUS_ASSIGN, QUESTION, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN,
125
+ STAR, STAR_ASSIGN, TYPE_EXTENSION_AND"/>
126
+ </module>
127
+ </module>
128
+ </module>
@@ -0,0 +1,108 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE module PUBLIC
3
+ "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
4
+ "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
5
+ <!--
6
+ This is a subset of ./checkstyle.xml which allows some loose styles
7
+ -->
8
+ <module name="Checker">
9
+ <module name="FileTabCharacter"/>
10
+ <module name="NewlineAtEndOfFile">
11
+ <property name="lineSeparator" value="lf"/>
12
+ </module>
13
+ <module name="RegexpMultiline">
14
+ <property name="format" value="\r"/>
15
+ <property name="message" value="Line contains carriage return"/>
16
+ </module>
17
+ <module name="RegexpMultiline">
18
+ <property name="format" value=" \n"/>
19
+ <property name="message" value="Line has trailing whitespace"/>
20
+ </module>
21
+ <module name="RegexpMultiline">
22
+ <property name="format" value="\n\n\n"/>
23
+ <property name="message" value="Multiple consecutive blank lines"/>
24
+ </module>
25
+ <module name="RegexpMultiline">
26
+ <property name="format" value="\n\n\Z"/>
27
+ <property name="message" value="Blank line before end of file"/>
28
+ </module>
29
+
30
+ <module name="TreeWalker">
31
+ <module name="EmptyBlock">
32
+ <property name="option" value="text"/>
33
+ <property name="tokens" value="
34
+ LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF,
35
+ LITERAL_FOR, LITERAL_TRY, LITERAL_WHILE, INSTANCE_INIT, STATIC_INIT"/>
36
+ </module>
37
+ <module name="EmptyStatement"/>
38
+ <module name="EmptyForInitializerPad"/>
39
+ <module name="EmptyForIteratorPad">
40
+ <property name="option" value="space"/>
41
+ </module>
42
+ <module name="MethodParamPad">
43
+ <property name="allowLineBreaks" value="true"/>
44
+ <property name="option" value="nospace"/>
45
+ </module>
46
+ <module name="ParenPad"/>
47
+ <module name="TypecastParenPad"/>
48
+ <module name="NeedBraces"/>
49
+ <module name="LeftCurly">
50
+ <property name="option" value="nl"/>
51
+ <property name="tokens" value="CLASS_DEF, CTOR_DEF, INTERFACE_DEF, METHOD_DEF"/>
52
+ </module>
53
+ <module name="LeftCurly">
54
+ <property name="option" value="eol"/>
55
+ <property name="tokens" value="
56
+ LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR,
57
+ LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE"/>
58
+ </module>
59
+ <module name="RightCurly">
60
+ <property name="option" value="alone"/>
61
+ </module>
62
+ <module name="GenericWhitespace"/>
63
+ <module name="WhitespaceAfter"/>
64
+ <module name="NoWhitespaceBefore"/>
65
+
66
+ <module name="UpperEll"/>
67
+ <module name="DefaultComesLast"/>
68
+ <module name="ArrayTypeStyle"/>
69
+ <module name="MultipleVariableDeclarations"/>
70
+ <module name="ModifierOrder"/>
71
+ <module name="OneStatementPerLine"/>
72
+ <module name="StringLiteralEquality"/>
73
+ <module name="MutableException"/>
74
+ <module name="EqualsHashCode"/>
75
+ <module name="InnerAssignment"/>
76
+ <module name="InterfaceIsType"/>
77
+ <module name="HideUtilityClassConstructor"/>
78
+
79
+ <module name="MemberName"/>
80
+ <module name="LocalVariableName"/>
81
+ <module name="LocalFinalVariableName"/>
82
+ <module name="TypeName"/>
83
+ <module name="PackageName"/>
84
+ <module name="ParameterName"/>
85
+ <module name="StaticVariableName"/>
86
+ <module name="ClassTypeParameterName">
87
+ <property name="format" value="^[A-Z][0-9]?$"/>
88
+ </module>
89
+ <module name="MethodTypeParameterName">
90
+ <property name="format" value="^[A-Z][0-9]?$"/>
91
+ </module>
92
+
93
+ <module name="WhitespaceAround">
94
+ <property name="allowEmptyConstructors" value="true"/>
95
+ <property name="allowEmptyMethods" value="true"/>
96
+ <property name="ignoreEnhancedForColon" value="false"/>
97
+ <property name="tokens" value="
98
+ ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN,
99
+ BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LE,
100
+ LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE,
101
+ LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN,
102
+ LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE,
103
+ LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL,
104
+ PLUS, PLUS_ASSIGN, QUESTION, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN,
105
+ STAR, STAR_ASSIGN, TYPE_EXTENSION_AND"/>
106
+ </module>
107
+ </module>
108
+ </module>
@@ -0,0 +1,11 @@
1
+ in:
2
+ type: vertica
3
+ host: 127.0.0.1
4
+ port: 5433
5
+ database: 'vdb'
6
+ user: dbadmin
7
+ password: xxxxx
8
+ schema: sandbox
9
+ table: embulk_test
10
+ out:
11
+ type: stdout
Binary file
@@ -0,0 +1,6 @@
1
+ #Wed Jan 13 12:41:02 JST 2016
2
+ distributionBase=GRADLE_USER_HOME
3
+ distributionPath=wrapper/dists
4
+ zipStoreBase=GRADLE_USER_HOME
5
+ zipStorePath=wrapper/dists
6
+ distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-bin.zip
data/gradlew ADDED
@@ -0,0 +1,164 @@
1
+ #!/usr/bin/env bash
2
+
3
+ ##############################################################################
4
+ ##
5
+ ## Gradle start up script for UN*X
6
+ ##
7
+ ##############################################################################
8
+
9
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10
+ DEFAULT_JVM_OPTS=""
11
+
12
+ APP_NAME="Gradle"
13
+ APP_BASE_NAME=`basename "$0"`
14
+
15
+ # Use the maximum available, or set MAX_FD != -1 to use that value.
16
+ MAX_FD="maximum"
17
+
18
+ warn ( ) {
19
+ echo "$*"
20
+ }
21
+
22
+ die ( ) {
23
+ echo
24
+ echo "$*"
25
+ echo
26
+ exit 1
27
+ }
28
+
29
+ # OS specific support (must be 'true' or 'false').
30
+ cygwin=false
31
+ msys=false
32
+ darwin=false
33
+ case "`uname`" in
34
+ CYGWIN* )
35
+ cygwin=true
36
+ ;;
37
+ Darwin* )
38
+ darwin=true
39
+ ;;
40
+ MINGW* )
41
+ msys=true
42
+ ;;
43
+ esac
44
+
45
+ # For Cygwin, ensure paths are in UNIX format before anything is touched.
46
+ if $cygwin ; then
47
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48
+ fi
49
+
50
+ # Attempt to set APP_HOME
51
+ # Resolve links: $0 may be a link
52
+ PRG="$0"
53
+ # Need this for relative symlinks.
54
+ while [ -h "$PRG" ] ; do
55
+ ls=`ls -ld "$PRG"`
56
+ link=`expr "$ls" : '.*-> \(.*\)$'`
57
+ if expr "$link" : '/.*' > /dev/null; then
58
+ PRG="$link"
59
+ else
60
+ PRG=`dirname "$PRG"`"/$link"
61
+ fi
62
+ done
63
+ SAVED="`pwd`"
64
+ cd "`dirname \"$PRG\"`/" >&-
65
+ APP_HOME="`pwd -P`"
66
+ cd "$SAVED" >&-
67
+
68
+ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69
+
70
+ # Determine the Java command to use to start the JVM.
71
+ if [ -n "$JAVA_HOME" ] ; then
72
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73
+ # IBM's JDK on AIX uses strange locations for the executables
74
+ JAVACMD="$JAVA_HOME/jre/sh/java"
75
+ else
76
+ JAVACMD="$JAVA_HOME/bin/java"
77
+ fi
78
+ if [ ! -x "$JAVACMD" ] ; then
79
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80
+
81
+ Please set the JAVA_HOME variable in your environment to match the
82
+ location of your Java installation."
83
+ fi
84
+ else
85
+ JAVACMD="java"
86
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87
+
88
+ Please set the JAVA_HOME variable in your environment to match the
89
+ location of your Java installation."
90
+ fi
91
+
92
+ # Increase the maximum file descriptors if we can.
93
+ if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94
+ MAX_FD_LIMIT=`ulimit -H -n`
95
+ if [ $? -eq 0 ] ; then
96
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97
+ MAX_FD="$MAX_FD_LIMIT"
98
+ fi
99
+ ulimit -n $MAX_FD
100
+ if [ $? -ne 0 ] ; then
101
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
102
+ fi
103
+ else
104
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105
+ fi
106
+ fi
107
+
108
+ # For Darwin, add options to specify how the application appears in the dock
109
+ if $darwin; then
110
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111
+ fi
112
+
113
+ # For Cygwin, switch paths to Windows format before running java
114
+ if $cygwin ; then
115
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117
+
118
+ # We build the pattern for arguments to be converted via cygpath
119
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120
+ SEP=""
121
+ for dir in $ROOTDIRSRAW ; do
122
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
123
+ SEP="|"
124
+ done
125
+ OURCYGPATTERN="(^($ROOTDIRS))"
126
+ # Add a user-defined pattern to the cygpath arguments
127
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129
+ fi
130
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
131
+ i=0
132
+ for arg in "$@" ; do
133
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135
+
136
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138
+ else
139
+ eval `echo args$i`="\"$arg\""
140
+ fi
141
+ i=$((i+1))
142
+ done
143
+ case $i in
144
+ (0) set -- ;;
145
+ (1) set -- "$args0" ;;
146
+ (2) set -- "$args0" "$args1" ;;
147
+ (3) set -- "$args0" "$args1" "$args2" ;;
148
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154
+ esac
155
+ fi
156
+
157
+ # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158
+ function splitJvmOpts() {
159
+ JVM_OPTS=("$@")
160
+ }
161
+ eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162
+ JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163
+
164
+ exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
data/gradlew.bat ADDED
@@ -0,0 +1,90 @@
1
+ @if "%DEBUG%" == "" @echo off
2
+ @rem ##########################################################################
3
+ @rem
4
+ @rem Gradle startup script for Windows
5
+ @rem
6
+ @rem ##########################################################################
7
+
8
+ @rem Set local scope for the variables with windows NT shell
9
+ if "%OS%"=="Windows_NT" setlocal
10
+
11
+ @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12
+ set DEFAULT_JVM_OPTS=
13
+
14
+ set DIRNAME=%~dp0
15
+ if "%DIRNAME%" == "" set DIRNAME=.
16
+ set APP_BASE_NAME=%~n0
17
+ set APP_HOME=%DIRNAME%
18
+
19
+ @rem Find java.exe
20
+ if defined JAVA_HOME goto findJavaFromJavaHome
21
+
22
+ set JAVA_EXE=java.exe
23
+ %JAVA_EXE% -version >NUL 2>&1
24
+ if "%ERRORLEVEL%" == "0" goto init
25
+
26
+ echo.
27
+ echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28
+ echo.
29
+ echo Please set the JAVA_HOME variable in your environment to match the
30
+ echo location of your Java installation.
31
+
32
+ goto fail
33
+
34
+ :findJavaFromJavaHome
35
+ set JAVA_HOME=%JAVA_HOME:"=%
36
+ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37
+
38
+ if exist "%JAVA_EXE%" goto init
39
+
40
+ echo.
41
+ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42
+ echo.
43
+ echo Please set the JAVA_HOME variable in your environment to match the
44
+ echo location of your Java installation.
45
+
46
+ goto fail
47
+
48
+ :init
49
+ @rem Get command-line arguments, handling Windowz variants
50
+
51
+ if not "%OS%" == "Windows_NT" goto win9xME_args
52
+ if "%@eval[2+2]" == "4" goto 4NT_args
53
+
54
+ :win9xME_args
55
+ @rem Slurp the command line arguments.
56
+ set CMD_LINE_ARGS=
57
+ set _SKIP=2
58
+
59
+ :win9xME_args_slurp
60
+ if "x%~1" == "x" goto execute
61
+
62
+ set CMD_LINE_ARGS=%*
63
+ goto execute
64
+
65
+ :4NT_args
66
+ @rem Get arguments from the 4NT Shell from JP Software
67
+ set CMD_LINE_ARGS=%$
68
+
69
+ :execute
70
+ @rem Setup the command line
71
+
72
+ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73
+
74
+ @rem Execute Gradle
75
+ "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76
+
77
+ :end
78
+ @rem End local scope for the variables with windows NT shell
79
+ if "%ERRORLEVEL%"=="0" goto mainEnd
80
+
81
+ :fail
82
+ rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83
+ rem the _cmd.exe /c_ return code!
84
+ if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85
+ exit /b 1
86
+
87
+ :mainEnd
88
+ if "%OS%"=="Windows_NT" endlocal
89
+
90
+ :omega
@@ -0,0 +1,3 @@
1
+ Embulk::JavaPlugin.register_input(
2
+ :vertica, "org.embulk.input.VerticaInputPlugin",
3
+ File.expand_path('../../../../classpath', __FILE__))
Binary file
Binary file
@@ -0,0 +1,90 @@
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 org.embulk.config.Config;
8
+ import org.embulk.config.ConfigDefault;
9
+ import org.embulk.input.jdbc.AbstractJdbcInputPlugin;
10
+ import org.embulk.input.jdbc.getter.ColumnGetterFactory;
11
+ import org.embulk.input.vertica.VerticaInputConnection;
12
+ import org.embulk.spi.PageBuilder;
13
+ import org.joda.time.DateTimeZone;
14
+
15
+ public class VerticaInputPlugin
16
+ extends AbstractJdbcInputPlugin
17
+ {
18
+ private static final Driver driver = new com.vertica.jdbc.Driver();
19
+
20
+ public interface VerticaPluginTask
21
+ extends PluginTask
22
+ {
23
+ @Config("host")
24
+ public String getHost();
25
+
26
+ @Config("port")
27
+ @ConfigDefault("5433")
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
+ @Config("schema")
41
+ @ConfigDefault("\"public\"")
42
+ public String getSchema();
43
+ }
44
+
45
+ @Override
46
+ protected Class<? extends PluginTask> getTaskClass()
47
+ {
48
+ return VerticaPluginTask.class;
49
+ }
50
+
51
+ @Override
52
+ protected VerticaInputConnection newConnection(PluginTask task) throws SQLException
53
+ {
54
+ VerticaPluginTask t = (VerticaPluginTask) task;
55
+
56
+ String url = String.format("jdbc:vertica://%s:%d/%s",
57
+ t.getHost(), t.getPort(), t.getDatabase());
58
+
59
+ Properties props = new Properties();
60
+ props.setProperty("user", t.getUser());
61
+ props.setProperty("password", t.getPassword());
62
+ props.setProperty("loginTimeout", String.valueOf(t.getConnectTimeout())); // seconds
63
+ props.setProperty("socketTimeout", String.valueOf(t.getSocketTimeout())); // seconds
64
+
65
+ // Enable keepalive based on tcp_keepalive_time, tcp_keepalive_intvl and tcp_keepalive_probes kernel parameters.
66
+ // Socket options TCP_KEEPCNT, TCP_KEEPIDLE, and TCP_KEEPINTVL are not configurable.
67
+ props.setProperty("tcpKeepAlive", "true");
68
+
69
+ // if (t.getSsl()) {
70
+ // // TODO add ssl_verify (boolean) option to allow users to verify certification.
71
+ // // see embulk-input-ftp for SSL implementation.
72
+ // props.setProperty("ssl", "true");
73
+ // props.setProperty("sslfactory", "org.vertica.ssl.NonValidatingFactory"); // disable server-side validation
74
+ // }
75
+ // // setting ssl=false enables SSL. See org.vertica.core.v3.openConnectionImpl.
76
+
77
+ props.putAll(t.getOptions());
78
+
79
+ Connection con = driver.connect(url, props);
80
+ try {
81
+ VerticaInputConnection c = new VerticaInputConnection(con, t.getSchema());
82
+ con = null;
83
+ return c;
84
+ } finally {
85
+ if (con != null) {
86
+ con.close();
87
+ }
88
+ }
89
+ }
90
+ }
@@ -0,0 +1,21 @@
1
+ package org.embulk.input.vertica;
2
+
3
+ import java.sql.Connection;
4
+ import java.sql.PreparedStatement;
5
+ import java.sql.ResultSet;
6
+ import java.sql.SQLException;
7
+ import org.slf4j.Logger;
8
+ import org.embulk.spi.Exec;
9
+ import org.embulk.input.jdbc.JdbcInputConnection;
10
+
11
+ public class VerticaInputConnection
12
+ extends JdbcInputConnection
13
+ {
14
+ private final Logger logger = Exec.getLogger(VerticaInputConnection.class);
15
+
16
+ public VerticaInputConnection(Connection connection, String schemaName)
17
+ throws SQLException
18
+ {
19
+ super(connection, schemaName);
20
+ }
21
+ }
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: embulk-input-vertica
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - sonots
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ requirement: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ~>
23
+ - !ruby/object:Gem::Version
24
+ version: '1.0'
25
+ prerelease: false
26
+ type: :development
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '10.0'
39
+ prerelease: false
40
+ type: :development
41
+ description: Loads records from Vertica.
42
+ email:
43
+ - sonots@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - COPYING
50
+ - README.md
51
+ - build.gradle
52
+ - checkstyle/checkstyle.xml
53
+ - checkstyle/default.xml
54
+ - example/example.yml
55
+ - gradle/wrapper/gradle-wrapper.jar
56
+ - gradle/wrapper/gradle-wrapper.properties
57
+ - gradlew
58
+ - gradlew.bat
59
+ - lib/embulk/input/vertica.rb
60
+ - lib/vertica-jdbc-7.0.1-0.jar
61
+ - lib/vertica-jdbc-7.2.1-0.jar
62
+ - src/main/java/org/embulk/input/VerticaInputPlugin.java
63
+ - src/main/java/org/embulk/input/vertica/VerticaInputConnection.java
64
+ - classpath/embulk-input-jdbc-0.6.4.jar
65
+ - classpath/embulk-input-vertica-0.1.0.jar
66
+ - classpath/vertica-jdbc-7.0.1-0.jar
67
+ homepage: https://github.com/sonots/embulk-input-vertica
68
+ licenses:
69
+ - MIT
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubyforge_project:
87
+ rubygems_version: 2.1.9
88
+ signing_key:
89
+ specification_version: 4
90
+ summary: Vertica input plugin for Embulk
91
+ test_files: []