embulk-output-jdbc 0.4.2 → 0.4.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d53fa63e0610150767ab330b29bf436707ed8ef
|
4
|
+
data.tar.gz: cca3319be7428f46e64c76abb47caf9cc03edb8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 188f1e9a3acc891c531ea531b2d7dac8c31070a2efe85645116bec8f1def2ce2380c743bf40e4001f2ddb96826322ac32c134a63c9a6afe87ca5993d3fef068f
|
7
|
+
data.tar.gz: bb9836e2bc55673a5943ff955d2046812bbeacf84984aa1cfed7b053ea4b4d14a5b3c9c41db1a7f24c08962e08515647e28d8515fa851cceeccaff35b2e58dec
|
Binary file
|
@@ -92,6 +92,9 @@ public abstract class AbstractJdbcOutputPlugin
|
|
92
92
|
public void setFeatures(Features features);
|
93
93
|
public Features getFeatures();
|
94
94
|
|
95
|
+
public Optional<JdbcSchema> getNewTableSchema();
|
96
|
+
public void setNewTableSchema(Optional<JdbcSchema> schema);
|
97
|
+
|
95
98
|
public JdbcSchema getTargetTableSchema();
|
96
99
|
public void setTargetTableSchema(JdbcSchema schema);
|
97
100
|
|
@@ -433,14 +436,17 @@ public abstract class AbstractJdbcOutputPlugin
|
|
433
436
|
JdbcSchema targetTableSchema;
|
434
437
|
if (initialTargetTableSchema.isPresent()) {
|
435
438
|
targetTableSchema = initialTargetTableSchema.get();
|
439
|
+
task.setNewTableSchema(Optional.<JdbcSchema>absent());
|
436
440
|
} else if (task.getIntermediateTables().isPresent() && !task.getIntermediateTables().get().isEmpty()) {
|
437
441
|
String firstItermTable = task.getIntermediateTables().get().get(0);
|
438
442
|
targetTableSchema = newJdbcSchemaFromTableIfExists(con, firstItermTable).get();
|
443
|
+
task.setNewTableSchema(Optional.of(newTableSchema));
|
439
444
|
} else {
|
440
445
|
// also create the target table if not exists
|
441
446
|
// CREATE TABLE IF NOT EXISTS xyz
|
442
447
|
con.createTableIfNotExists(task.getTable(), newTableSchema);
|
443
448
|
targetTableSchema = newJdbcSchemaFromTableIfExists(con, task.getTable()).get();
|
449
|
+
task.setNewTableSchema(Optional.<JdbcSchema>absent());
|
444
450
|
}
|
445
451
|
task.setTargetTableSchema(matchSchemaByColumnNames(schema, targetTableSchema));
|
446
452
|
|
@@ -588,16 +594,25 @@ public abstract class AbstractJdbcOutputPlugin
|
|
588
594
|
|
589
595
|
case INSERT:
|
590
596
|
// aggregate insert into target
|
597
|
+
if (task.getNewTableSchema().isPresent()) {
|
598
|
+
con.createTableIfNotExists(task.getTable(), task.getNewTableSchema().get());
|
599
|
+
}
|
591
600
|
con.collectInsert(task.getIntermediateTables().get(), schema, task.getTable(), false);
|
592
601
|
break;
|
593
602
|
|
594
603
|
case TRUNCATE_INSERT:
|
595
604
|
// truncate & aggregate insert into target
|
605
|
+
if (task.getNewTableSchema().isPresent()) {
|
606
|
+
con.createTableIfNotExists(task.getTable(), task.getNewTableSchema().get());
|
607
|
+
}
|
596
608
|
con.collectInsert(task.getIntermediateTables().get(), schema, task.getTable(), true);
|
597
609
|
break;
|
598
610
|
|
599
611
|
case MERGE:
|
600
612
|
// aggregate merge into target
|
613
|
+
if (task.getNewTableSchema().isPresent()) {
|
614
|
+
con.createTableIfNotExists(task.getTable(), task.getNewTableSchema().get());
|
615
|
+
}
|
601
616
|
con.collectMerge(task.getIntermediateTables().get(), schema, task.getTable(), task.getMergeKeys().get());
|
602
617
|
break;
|
603
618
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-output-jdbc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.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: 2015-12-
|
11
|
+
date: 2015-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Inserts or updates records to a table.
|
14
14
|
email:
|
@@ -53,7 +53,7 @@ files:
|
|
53
53
|
- src/main/java/org/embulk/output/jdbc/setter/SqlTimestampColumnSetter.java
|
54
54
|
- src/main/java/org/embulk/output/jdbc/setter/StringColumnSetter.java
|
55
55
|
- src/test/java/org/embulk/output/TestJdbcOutputPlugin.java
|
56
|
-
- classpath/embulk-output-jdbc-0.4.
|
56
|
+
- classpath/embulk-output-jdbc-0.4.3.jar
|
57
57
|
homepage: https://github.com/embulk/embulk-output-jdbc
|
58
58
|
licenses:
|
59
59
|
- Apache 2.0
|