embulk-output-db2 0.8.2 → 0.8.3

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: 2ea80ccc26c0eb03d28d8c273699db1e80bc49fb
4
- data.tar.gz: 07d90d9a9299675b23c4e85546c5dfa35cceb843
3
+ metadata.gz: a26f16b2fb307b8dba807962ad3e0ddc86ba3486
4
+ data.tar.gz: 552f4824ca629f4729b1704119078b73f6c16259
5
5
  SHA512:
6
- metadata.gz: 3be3752a225088a373f10740fd41e5462f2bcaec9d6d64d786289952484bd81fee73c2e8e60b578eba96edd829f6de1c077891a747c4ca64b280782d8c04171e
7
- data.tar.gz: b83df165f7909f4707d134d772a1a6787223cf263c20369672b566f86db2b7c4e2cbda811796ccac49d3c0c13845b6d26c226e0d09bcc98b7f3b24ec5a732fa8
6
+ metadata.gz: 0d3fb1fa22f04495deac7e275cc61a772dd6fc911acc3da3719ed505e3072efc15a2e44cb0655466033abc1dbed7015eddc95a1c28bab1d35c596fcb6c6cc538
7
+ data.tar.gz: 6f0487384ca6d84e3bf24e6d49bc87dbeb6301f8d04996f04c6198d6beb1b49981f18f78a0da52f5f0f256f3afbebdaf583c4000e0ee5137798ad4f0101e5749
data/README.md CHANGED
@@ -20,8 +20,9 @@ DB2 output plugins for Embulk loads records to DB2.
20
20
  - **table**: destination table name (string, required)
21
21
  - **create_table_constraint**: table constraint added to `CREATE TABLE` statement, like `CREATE TABLE <table_name> (<column1> <type1>, <column2> <type2>, ..., <create_table_constraint>) <create_table_option>`.
22
22
  - **create_table_option**: table option added to `CREATE TABLE` statement, like `CREATE TABLE <table_name> (<column1> <type1>, <column2> <type2>, ..., <create_table_constraint>) <create_table_option>`.
23
+ - **transaction_isolation**: transaction isolation level for each connection ("read_uncommitted", "read_committed", "repeatable_read" or "serializable"). if not specified, database default value will be used.
23
24
  - **options**: extra connection properties (hash, default: {})
24
- - **retry_limit**: max retry count for database operations (integer, default: 12)
25
+ - **retry_limit**: max retry count for database operations (integer, default: 12). When intermediate table to create already created by another process, this plugin will retry with another table name to avoid collision.
25
26
  - **retry_wait**: initial retry wait time in milliseconds (integer, default: 1000 (1 second))
26
27
  - **max_retry_wait**: upper limit of retry wait, which will be doubled at every retry (integer, default: 1800000 (30 minutes))
27
28
  - **mode**: "insert", "insert_direct", "truncate_insert" or "replace". See below. (string, required)
@@ -0,0 +1,2 @@
1
+ table: TEST_CHAR
2
+ mode: replace
@@ -9,6 +9,7 @@ import org.embulk.config.ConfigDefault;
9
9
  import org.embulk.output.db2.DB2BatchInsert;
10
10
  import org.embulk.output.db2.DB2OutputConnector;
11
11
  import org.embulk.output.jdbc.AbstractJdbcOutputPlugin;
12
+ import org.embulk.output.jdbc.JdbcOutputConnector;
12
13
  import org.embulk.output.jdbc.BatchInsert;
13
14
  import org.embulk.output.jdbc.MergeConfig;
14
15
 
@@ -60,7 +61,7 @@ public class DB2OutputPlugin
60
61
  }
61
62
 
62
63
  @Override
63
- protected DB2OutputConnector getConnector(PluginTask task, boolean retryableMetadataOperation)
64
+ protected JdbcOutputConnector getConnector(PluginTask task, boolean retryableMetadataOperation)
64
65
  {
65
66
  DB2PluginTask db2Task = (DB2PluginTask) task;
66
67
 
@@ -79,7 +80,7 @@ public class DB2OutputPlugin
79
80
  }
80
81
  logConnectionProperties(url, props);
81
82
 
82
- return new DB2OutputConnector(url, props, null);
83
+ return new DB2OutputConnector(url, props, null, task.getTransactionIsolation());
83
84
  }
84
85
 
85
86
  @Override
@@ -3,6 +3,7 @@ package org.embulk.output.db2;
3
3
  import java.io.IOException;
4
4
  import java.sql.SQLException;
5
5
 
6
+ import org.embulk.output.jdbc.JdbcOutputConnector;
6
7
  import org.embulk.output.jdbc.MergeConfig;
7
8
  import org.embulk.output.jdbc.StandardBatchInsert;
8
9
 
@@ -11,7 +12,7 @@ import com.google.common.base.Optional;
11
12
  public class DB2BatchInsert
12
13
  extends StandardBatchInsert
13
14
  {
14
- public DB2BatchInsert(DB2OutputConnector connector, Optional<MergeConfig> mergeConfig) throws IOException, SQLException
15
+ public DB2BatchInsert(JdbcOutputConnector connector, Optional<MergeConfig> mergeConfig) throws IOException, SQLException
15
16
  {
16
17
  super(connector, mergeConfig);
17
18
  }
@@ -12,11 +12,10 @@ import static java.util.Locale.ENGLISH;
12
12
  public class DB2OutputConnection
13
13
  extends JdbcOutputConnection
14
14
  {
15
- public DB2OutputConnection(Connection connection, String schemaName, boolean autoCommit)
15
+ public DB2OutputConnection(Connection connection, String schemaName)
16
16
  throws SQLException
17
17
  {
18
18
  super(connection, schemaName);
19
- connection.setAutoCommit(autoCommit);
20
19
  }
21
20
 
22
21
  @Override
@@ -5,17 +5,23 @@ import java.sql.DriverManager;
5
5
  import java.sql.SQLException;
6
6
  import java.util.Properties;
7
7
 
8
- import org.embulk.output.jdbc.JdbcOutputConnector;
8
+ import org.embulk.output.jdbc.JdbcOutputConnection;
9
+ import org.embulk.output.jdbc.AbstractJdbcOutputConnector;
10
+ import org.embulk.output.jdbc.TransactionIsolation;
11
+
12
+ import com.google.common.base.Optional;
9
13
 
10
14
  public class DB2OutputConnector
11
- implements JdbcOutputConnector
15
+ extends AbstractJdbcOutputConnector
12
16
  {
13
17
  private final String url;
14
18
  private final Properties properties;
15
19
  private final String schemaName;
16
20
 
17
- public DB2OutputConnector(String url, Properties properties, String schemaName)
21
+ public DB2OutputConnector(String url, Properties properties, String schemaName,
22
+ Optional<TransactionIsolation> transactionIsolation)
18
23
  {
24
+ super(transactionIsolation);
19
25
  try {
20
26
  Class.forName("com.ibm.db2.jcc.DB2Driver");
21
27
  } catch (Exception ex) {
@@ -27,7 +33,7 @@ public class DB2OutputConnector
27
33
  }
28
34
 
29
35
  @Override
30
- public DB2OutputConnection connect(boolean autoCommit) throws SQLException
36
+ protected JdbcOutputConnection connect() throws SQLException
31
37
  {
32
38
  Connection c = DriverManager.getConnection(url, properties);
33
39
  if (c == null) {
@@ -36,7 +42,7 @@ public class DB2OutputConnector
36
42
  }
37
43
 
38
44
  try {
39
- DB2OutputConnection con = new DB2OutputConnection(c, schemaName, autoCommit);
45
+ DB2OutputConnection con = new DB2OutputConnection(c, schemaName);
40
46
  c = null;
41
47
  return con;
42
48
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-output-db2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-30 00:00:00.000000000 Z
11
+ date: 2019-05-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Inserts or updates records to a table.
14
14
  email:
@@ -19,9 +19,10 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - README.md
21
21
  - build.gradle
22
- - classpath/embulk-output-db2-0.8.2.jar
23
- - classpath/embulk-output-jdbc-0.8.2.jar
22
+ - classpath/embulk-output-db2-0.8.3.jar
23
+ - classpath/embulk-output-jdbc-0.8.3.jar
24
24
  - lib/embulk/output/db2.rb
25
+ - out/test/org/embulk/output/db2/test/expect/basic/test_replace.yml
25
26
  - src/main/java/org/embulk/output/DB2OutputPlugin.java
26
27
  - src/main/java/org/embulk/output/db2/DB2BatchInsert.java
27
28
  - src/main/java/org/embulk/output/db2/DB2OutputConnection.java
Binary file
Binary file