embulk-input-vertica 0.1.1 → 0.1.2

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: 42c918e05a7a36c3d44401a4fcf2720612144b16
4
- data.tar.gz: 4c2aa39ef52247884cd8a461ae4dd3c22e5207d2
3
+ metadata.gz: 859d1f2716cc5ff691ed1c040a0be20a00582c34
4
+ data.tar.gz: b3aee724019f0092802a73e783681f6a9d4f392c
5
5
  SHA512:
6
- metadata.gz: e682ae3bdd721a275acbc348ba37d32b78b161f9ced536daf126bfd65c5910856fba1d1f841b88899143e9c6337dccfdd97432758d310e52162af324a1d052a4
7
- data.tar.gz: 893067fb4e42f2e5b07c01b0a39f4325cb84ecbe91a866d06cdb728509a3b89612073a14fbd5067ebf4ecb9ebf72c307c3a9e18761427a032c3b4d7e80c5270c
6
+ metadata.gz: 5c4bd57db32969f155385b8fc88300297f87575bf44b049fcff832e8b96e30f5be7365938246349674c86e38b6caa456447a81d257f6bfe25aadf606a550bf31
7
+ data.tar.gz: 1d82ea31cc168a87283ca7e5db7243f8b6d0a5e02833781cc3323f7ac0ba34f1249a8e0655df14d8956a0f900209fbc957dbc934390e3670d8b5c9b385b24e52
data/.gitignore CHANGED
@@ -10,3 +10,4 @@ build/
10
10
  .tags
11
11
  .ruby-version
12
12
  example2
13
+ *.iml
@@ -1,3 +1,9 @@
1
+ # 0.1.2
2
+
3
+ Enhancements:
4
+
5
+ * Add `resouce_pool` option
6
+
1
7
  # 0.1.1
2
8
 
3
9
  Changes:
data/README.md CHANGED
@@ -18,6 +18,7 @@ Vertica input plugins for Embulk loads records from vertica.
18
18
  - **fetch_rows**: number of rows to fetch one time (used for java.sql.Statement#setFetchSize) (integer, default: 10000)
19
19
  - **connect_timeout**: timeout for establishment of a database connection. (integer (seconds), default: 300)
20
20
  - **socket_timeout**: timeout for socket read operations. 0 means no timeout. (integer (seconds), default: 1800)
21
+ - **resource_pool**: set session resource pool (string, default: null)
21
22
  - **ssl**: ~~enables SSL. data will be encrypted but CA or certification will not be verified (boolean, default: false)~~ Not supported yet
22
23
  - **options**: extra JDBC properties (hash, default: {})
23
24
  - If you write SQL directly,
@@ -16,7 +16,7 @@ configurations {
16
16
  provided
17
17
  }
18
18
 
19
- version = "0.1.1"
19
+ version = "0.1.2"
20
20
 
21
21
  sourceCompatibility = 1.7
22
22
  targetCompatibility = 1.7
@@ -0,0 +1 @@
1
+ rootProject.name = 'embulk-input-vertica'
@@ -1,5 +1,9 @@
1
1
  package org.embulk.input;
2
2
 
3
+ import com.google.common.base.Optional;
4
+
5
+ import java.sql.PreparedStatement;
6
+ import java.sql.Statement;
3
7
  import java.util.Properties;
4
8
  import java.sql.Connection;
5
9
  import java.sql.Driver;
@@ -7,14 +11,15 @@ import java.sql.SQLException;
7
11
  import org.embulk.config.Config;
8
12
  import org.embulk.config.ConfigDefault;
9
13
  import org.embulk.input.jdbc.AbstractJdbcInputPlugin;
10
- import org.embulk.input.jdbc.getter.ColumnGetterFactory;
11
14
  import org.embulk.input.vertica.VerticaInputConnection;
12
- import org.embulk.spi.PageBuilder;
13
- import org.joda.time.DateTimeZone;
15
+
16
+ import org.embulk.spi.Exec;
17
+ import org.slf4j.Logger;
14
18
 
15
19
  public class VerticaInputPlugin
16
20
  extends AbstractJdbcInputPlugin
17
21
  {
22
+ private final Logger logger = Exec.getLogger(VerticaInputPlugin.class);
18
23
  private static final Driver driver = new com.vertica.jdbc.Driver();
19
24
 
20
25
  public interface VerticaPluginTask
@@ -40,6 +45,10 @@ public class VerticaInputPlugin
40
45
  @Config("schema")
41
46
  @ConfigDefault("\"public\"")
42
47
  public String getSchema();
48
+
49
+ @Config("resource_pool")
50
+ @ConfigDefault("null")
51
+ public Optional<String> getResourcePool();
43
52
  }
44
53
 
45
54
  @Override
@@ -77,7 +86,16 @@ public class VerticaInputPlugin
77
86
  props.putAll(t.getOptions());
78
87
 
79
88
  Connection con = driver.connect(url, props);
89
+
80
90
  try {
91
+ if (t.getResourcePool().isPresent()) {
92
+ Statement stmt = con.createStatement();
93
+ String escapedResourcePool = t.getResourcePool().get().replaceAll("'", "''");
94
+ String sql = String.format("SET SESSION RESOURCE_POOL = '%s'", escapedResourcePool);
95
+ logger.info("SQL: " + sql);
96
+ stmt.execute(sql);
97
+ }
98
+
81
99
  VerticaInputConnection c = new VerticaInputConnection(con, t.getSchema());
82
100
  con = null;
83
101
  return c;
@@ -1,8 +1,6 @@
1
1
  package org.embulk.input.vertica;
2
2
 
3
3
  import java.sql.Connection;
4
- import java.sql.PreparedStatement;
5
- import java.sql.ResultSet;
6
4
  import java.sql.SQLException;
7
5
  import org.slf4j.Logger;
8
6
  import org.embulk.spi.Exec;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-vertica
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-29 00:00:00.000000000 Z
11
+ date: 2016-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -60,11 +60,12 @@ files:
60
60
  - lib/embulk/input/vertica.rb
61
61
  - lib/vertica-jdbc-7.0.1-0.jar
62
62
  - lib/vertica-jdbc-7.2.1-0.jar
63
+ - settings.gradle
63
64
  - src/main/java/org/embulk/input/VerticaInputPlugin.java
64
65
  - src/main/java/org/embulk/input/vertica/VerticaInputConnection.java
65
66
  - classpath/embulk-core-0.8.8.jar
66
67
  - classpath/embulk-input-jdbc-0.7.0.jar
67
- - classpath/embulk-input-vertica-0.1.1.jar
68
+ - classpath/embulk-input-vertica-0.1.2.jar
68
69
  - classpath/joda-time-2.9.2.jar
69
70
  - classpath/jruby-complete-9.0.5.0.jar
70
71
  - classpath/msgpack-core-0.8.3.jar