embulk-output-redshift 0.6.4 → 0.6.5

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: 4f9b1303b4c1343a10b77b15b07fca1536c919ac
4
- data.tar.gz: 3fe7932bc6a6a3d0125c88e9e60c8e9ac05cb4d6
3
+ metadata.gz: 1d4312dc6d69048d1110819001f7bdde9ad8325d
4
+ data.tar.gz: 2010563c7f915628a45777464860af452fdd1b38
5
5
  SHA512:
6
- metadata.gz: e06bf310d402011178bb190ae8ad2240ad97ddebba96e54f681e49890e52de6cb5175c6a78152bb124a70159a345a21ad5aa67745e145a34116598736f4e28bf
7
- data.tar.gz: 434386a4927d5f7df605142e93c5870ec3c7b3194bac5c7d3b0b56161c51beec09f44480510dcbe290412a3846c125874caa62b95a9651ac1631738a457eaad0
6
+ metadata.gz: 4dbcc3cc2b2cd76abec1ab8e1e542690d1d45fece61e42183303c8d8655b67fea1686878f1e4d872bd1260feccf4fb43ad3212a4b6c226edd9225de3bdff9a17
7
+ data.tar.gz: d000f9b23aba4bcd91844e8ecfcf5bd631eaa1f492376986dc847daa03a4ffcf5c3b278545f14debb0711eaf27519f4be9ee1732846e958a004f142d4042abf1
@@ -5,7 +5,6 @@ import java.sql.Connection;
5
5
  import java.sql.SQLException;
6
6
  import java.sql.Statement;
7
7
 
8
- import com.google.common.base.Optional;
9
8
  import org.embulk.output.jdbc.MergeConfig;
10
9
  import org.slf4j.Logger;
11
10
  import org.embulk.spi.Exec;
@@ -134,14 +133,14 @@ public class RedshiftOutputConnection
134
133
  sb.append("DELETE FROM ");
135
134
  quoteIdentifierString(sb, toTable);
136
135
  sb.append(" USING (");
137
- for(int i=0; i < fromTables.size(); i++) {
138
- if(i != 0) { sb.append(" UNION ALL "); }
136
+ for (int i = 0; i < fromTables.size(); i++) {
137
+ if (i != 0) { sb.append(" UNION ALL "); }
139
138
  sb.append("SELECT * FROM ");
140
139
  quoteIdentifierString(sb, fromTables.get(i));
141
140
  }
142
141
  sb.append(") S WHERE (");
143
142
  List<String> mergeKeys = mergeConfig.getMergeKeys();
144
- for(int i=0; i < mergeKeys.size(); i++) {
143
+ for (int i = 0; i < mergeKeys.size(); i++) {
145
144
  if (i != 0) { sb.append(" AND "); }
146
145
  sb.append("S.");
147
146
  quoteIdentifierString(sb, mergeKeys.get(i));
@@ -155,10 +154,15 @@ public class RedshiftOutputConnection
155
154
  sb.append("INSERT INTO ");
156
155
  quoteIdentifierString(sb, toTable);
157
156
  sb.append(" (");
158
- for(int i=0; i < fromTables.size(); i++) {
159
- if(i != 0) { sb.append(" UNION ALL "); }
157
+ for (int i = 0; i < schema.getCount(); i++) {
158
+ if (i != 0) { sb.append(", "); }
159
+ quoteIdentifierString(sb, schema.getColumnName(i));
160
+ }
161
+ sb.append(") (");
162
+ for (int i = 0; i < fromTables.size(); i++) {
163
+ if (i != 0) { sb.append(" UNION ALL "); }
160
164
  sb.append("SELECT ");
161
- for(int j=0; j < schema.getCount(); j++) {
165
+ for (int j = 0; j < schema.getCount(); j++) {
162
166
  if (j != 0) { sb.append(", "); }
163
167
  quoteIdentifierString(sb, schema.getColumnName(j));
164
168
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-output-redshift
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-30 00:00:00.000000000 Z
11
+ date: 2016-10-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Inserts or updates records to a table.
14
14
  email:
@@ -25,9 +25,9 @@ files:
25
25
  - classpath/aws-java-sdk-sts-1.10.33.jar
26
26
  - classpath/commons-codec-1.6.jar
27
27
  - classpath/commons-logging-1.1.3.jar
28
- - classpath/embulk-output-jdbc-0.6.4.jar
29
- - classpath/embulk-output-postgresql-0.6.4.jar
30
- - classpath/embulk-output-redshift-0.6.4.jar
28
+ - classpath/embulk-output-jdbc-0.6.5.jar
29
+ - classpath/embulk-output-postgresql-0.6.5.jar
30
+ - classpath/embulk-output-redshift-0.6.5.jar
31
31
  - classpath/httpclient-4.3.6.jar
32
32
  - classpath/httpcore-4.3.3.jar
33
33
  - classpath/postgresql-9.4-1205-jdbc41.jar