From d9357169924d29e1f110388f88216f58a09a0cf1 Mon Sep 17 00:00:00 2001 From: hito4t Date: Tue, 5 Apr 2016 11:39:32 +0900 Subject: [PATCH 1/6] Support json --- .../output/jdbc/setter/BigDecimalColumnSetter.java | 8 ++++++++ .../output/jdbc/setter/BooleanColumnSetter.java | 8 ++++++++ .../output/jdbc/setter/ByteColumnSetter.java | 9 +++++++++ .../embulk/output/jdbc/setter/ColumnSetter.java | 8 ++++++-- .../output/jdbc/setter/ColumnSetterFactory.java | 2 ++ .../output/jdbc/setter/ColumnSetterVisitor.java | 14 ++++++++++++-- .../output/jdbc/setter/DefaultValueSetter.java | 2 ++ .../output/jdbc/setter/DoubleColumnSetter.java | 8 ++++++++ .../output/jdbc/setter/FloatColumnSetter.java | 8 ++++++++ .../embulk/output/jdbc/setter/IntColumnSetter.java | 9 +++++++++ .../output/jdbc/setter/LongColumnSetter.java | 9 +++++++++ .../output/jdbc/setter/NStringColumnSetter.java | 8 ++++++++ .../output/jdbc/setter/NullColumnSetter.java | 8 ++++++++ .../output/jdbc/setter/NullDefaultValueSetter.java | 6 ++++++ .../jdbc/setter/PassThroughColumnSetter.java | 8 ++++++++ .../output/jdbc/setter/ShortColumnSetter.java | 9 +++++++++ .../output/jdbc/setter/SkipColumnSetter.java | 6 ++++++ .../output/jdbc/setter/SqlDateColumnSetter.java | 8 ++++++++ .../output/jdbc/setter/SqlTimeColumnSetter.java | 8 ++++++++ .../jdbc/setter/SqlTimestampColumnSetter.java | 8 ++++++++ .../output/jdbc/setter/StringColumnSetter.java | 8 ++++++++ 21 files changed, 158 insertions(+), 4 deletions(-) diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/BigDecimalColumnSetter.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/BigDecimalColumnSetter.java index 709c5119..82895cb3 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/BigDecimalColumnSetter.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/BigDecimalColumnSetter.java @@ -3,9 +3,11 @@ import java.math.BigDecimal; import java.io.IOException; import java.sql.SQLException; + import org.embulk.spi.time.Timestamp; import org.embulk.output.jdbc.JdbcColumn; import org.embulk.output.jdbc.BatchInsert; +import org.msgpack.value.Value; public class BigDecimalColumnSetter extends ColumnSetter @@ -65,4 +67,10 @@ public void timestampValue(Timestamp v) throws IOException, SQLException { defaultValue.setBigDecimal(); } + + @Override + public void jsonValue(Value v) throws IOException, SQLException + { + defaultValue.setBigDecimal(); + } } diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/BooleanColumnSetter.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/BooleanColumnSetter.java index 28f9ddac..4633fb23 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/BooleanColumnSetter.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/BooleanColumnSetter.java @@ -2,9 +2,11 @@ import java.io.IOException; import java.sql.SQLException; + import org.embulk.spi.time.Timestamp; import org.embulk.output.jdbc.JdbcColumn; import org.embulk.output.jdbc.BatchInsert; +import org.msgpack.value.Value; public class BooleanColumnSetter extends ColumnSetter @@ -50,4 +52,10 @@ public void timestampValue(Timestamp v) throws IOException, SQLException { defaultValue.setBoolean(); } + + @Override + public void jsonValue(Value v) throws IOException, SQLException + { + defaultValue.setBoolean(); + } } diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/ByteColumnSetter.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/ByteColumnSetter.java index c7e8dfbd..cfcb4c19 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/ByteColumnSetter.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/ByteColumnSetter.java @@ -3,10 +3,13 @@ import java.io.IOException; import java.sql.SQLException; import java.math.RoundingMode; + import com.google.common.math.DoubleMath; + import org.embulk.spi.time.Timestamp; import org.embulk.output.jdbc.JdbcColumn; import org.embulk.output.jdbc.BatchInsert; +import org.msgpack.value.Value; public class ByteColumnSetter extends ColumnSetter @@ -72,4 +75,10 @@ public void timestampValue(Timestamp v) throws IOException, SQLException { defaultValue.setByte(); } + + @Override + public void jsonValue(Value v) throws IOException, SQLException + { + defaultValue.setByte(); + } } diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/ColumnSetter.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/ColumnSetter.java index bc47fe44..96327e68 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/ColumnSetter.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/ColumnSetter.java @@ -2,9 +2,11 @@ import java.io.IOException; import java.sql.SQLException; -import org.embulk.spi.time.Timestamp; -import org.embulk.output.jdbc.JdbcColumn; + import org.embulk.output.jdbc.BatchInsert; +import org.embulk.output.jdbc.JdbcColumn; +import org.embulk.spi.time.Timestamp; +import org.msgpack.value.Value; public abstract class ColumnSetter { @@ -41,4 +43,6 @@ public int getSqlType() public abstract void stringValue(String v) throws IOException, SQLException; public abstract void timestampValue(Timestamp v) throws IOException, SQLException; + + public abstract void jsonValue(Value v) throws IOException, SQLException; } diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/ColumnSetterFactory.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/ColumnSetterFactory.java index 819219c3..ebdbcd93 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/ColumnSetterFactory.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/ColumnSetterFactory.java @@ -62,6 +62,8 @@ public ColumnSetter newColumnSetter(JdbcColumn column, JdbcColumnOption option) return new SqlTimestampColumnSetter(batch, column, newDefaultValueSetter(column, option), newCalendar(option)); case "decimal": return new BigDecimalColumnSetter(batch, column, newDefaultValueSetter(column, option)); + case "json": + return new JsonColumnSetter(batch, column, newDefaultValueSetter(column, option)); case "null": return new NullColumnSetter(batch, column, newDefaultValueSetter(column, option)); case "pass": diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/ColumnSetterVisitor.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/ColumnSetterVisitor.java index 3f1185e7..563c6d6b 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/ColumnSetterVisitor.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/ColumnSetterVisitor.java @@ -79,8 +79,18 @@ public void stringColumn(Column column) } @Override - public void jsonColumn(Column column) { - throw new UnsupportedOperationException("This plugin doesn't support json type. Please try to upgrade version of the plugin using 'embulk gem update' command. If the latest version still doesn't support json type, please contact plugin developers, or change configuration of input plugin not to use json type."); + public void jsonColumn(Column column) + { + try { + if (pageReader.isNull(column)) { + setter.nullValue(); + } else { + setter.jsonValue(pageReader.getJson(column)); + } + } catch (IOException | SQLException ex) { + // TODO exception class + throw new RuntimeException(ex); + } } @Override diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/DefaultValueSetter.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/DefaultValueSetter.java index 4cd33ee9..6fae0475 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/DefaultValueSetter.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/DefaultValueSetter.java @@ -45,4 +45,6 @@ public DefaultValueSetter(BatchInsert batch, JdbcColumn column) public abstract void setSqlTime() throws IOException, SQLException; public abstract void setSqlTimestamp() throws IOException, SQLException; + + public abstract void setJson() throws IOException, SQLException; } diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/DoubleColumnSetter.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/DoubleColumnSetter.java index 53eb5818..c84b84eb 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/DoubleColumnSetter.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/DoubleColumnSetter.java @@ -2,9 +2,11 @@ import java.io.IOException; import java.sql.SQLException; + import org.embulk.spi.time.Timestamp; import org.embulk.output.jdbc.JdbcColumn; import org.embulk.output.jdbc.BatchInsert; +import org.msgpack.value.Value; public class DoubleColumnSetter extends ColumnSetter @@ -57,4 +59,10 @@ public void timestampValue(Timestamp v) throws IOException, SQLException { defaultValue.setDouble(); } + + @Override + public void jsonValue(Value v) throws IOException, SQLException + { + defaultValue.setDouble(); + } } diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/FloatColumnSetter.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/FloatColumnSetter.java index 2f54c1bc..784540a2 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/FloatColumnSetter.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/FloatColumnSetter.java @@ -2,9 +2,11 @@ import java.io.IOException; import java.sql.SQLException; + import org.embulk.spi.time.Timestamp; import org.embulk.output.jdbc.JdbcColumn; import org.embulk.output.jdbc.BatchInsert; +import org.msgpack.value.Value; public class FloatColumnSetter extends ColumnSetter @@ -57,4 +59,10 @@ public void timestampValue(Timestamp v) throws IOException, SQLException { defaultValue.setFloat(); } + + @Override + public void jsonValue(Value v) throws IOException, SQLException + { + defaultValue.setFloat(); + } } diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/IntColumnSetter.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/IntColumnSetter.java index 95e8d4c0..063c87f5 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/IntColumnSetter.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/IntColumnSetter.java @@ -3,10 +3,13 @@ import java.io.IOException; import java.sql.SQLException; import java.math.RoundingMode; + import com.google.common.math.DoubleMath; + import org.embulk.spi.time.Timestamp; import org.embulk.output.jdbc.JdbcColumn; import org.embulk.output.jdbc.BatchInsert; +import org.msgpack.value.Value; public class IntColumnSetter extends ColumnSetter @@ -72,4 +75,10 @@ public void timestampValue(Timestamp v) throws IOException, SQLException { defaultValue.setInt(); } + + @Override + public void jsonValue(Value v) throws IOException, SQLException + { + defaultValue.setInt(); + } } diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/LongColumnSetter.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/LongColumnSetter.java index 3a241d8d..d0fdd8b6 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/LongColumnSetter.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/LongColumnSetter.java @@ -3,10 +3,13 @@ import java.io.IOException; import java.sql.SQLException; import java.math.RoundingMode; + import com.google.common.math.DoubleMath; + import org.embulk.spi.time.Timestamp; import org.embulk.output.jdbc.JdbcColumn; import org.embulk.output.jdbc.BatchInsert; +import org.msgpack.value.Value; public class LongColumnSetter extends ColumnSetter @@ -68,4 +71,10 @@ public void timestampValue(Timestamp v) throws IOException, SQLException { defaultValue.setLong(); } + + @Override + public void jsonValue(Value v) throws IOException, SQLException + { + defaultValue.setLong(); + } } diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/NStringColumnSetter.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/NStringColumnSetter.java index 8af163fe..f8400df2 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/NStringColumnSetter.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/NStringColumnSetter.java @@ -2,10 +2,12 @@ import java.io.IOException; import java.sql.SQLException; + import org.embulk.spi.time.Timestamp; import org.embulk.spi.time.TimestampFormatter; import org.embulk.output.jdbc.JdbcColumn; import org.embulk.output.jdbc.BatchInsert; +import org.msgpack.value.Value; public class NStringColumnSetter extends ColumnSetter @@ -55,4 +57,10 @@ public void timestampValue(Timestamp v) throws IOException, SQLException { batch.setNString(timestampFormatter.format(v)); } + + @Override + public void jsonValue(Value v) throws IOException, SQLException + { + defaultValue.setNString(); + } } diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/NullColumnSetter.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/NullColumnSetter.java index d87a2677..80f19378 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/NullColumnSetter.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/NullColumnSetter.java @@ -2,9 +2,11 @@ import java.io.IOException; import java.sql.SQLException; + import org.embulk.spi.time.Timestamp; import org.embulk.output.jdbc.JdbcColumn; import org.embulk.output.jdbc.BatchInsert; +import org.msgpack.value.Value; public class NullColumnSetter extends ColumnSetter @@ -50,4 +52,10 @@ public void nullValue() throws IOException, SQLException { defaultValue.setNull(); } + + @Override + public void jsonValue(Value v) throws IOException, SQLException + { + defaultValue.setNull(); + } } diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/NullDefaultValueSetter.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/NullDefaultValueSetter.java index 54881d9a..065aa389 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/NullDefaultValueSetter.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/NullDefaultValueSetter.java @@ -102,4 +102,10 @@ public void setSqlTimestamp() throws IOException, SQLException { batch.setNull(column.getSqlType()); } + + @Override + public void setJson() throws IOException, SQLException + { + batch.setNull(column.getSqlType()); + } } diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/PassThroughColumnSetter.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/PassThroughColumnSetter.java index f89ba4f6..c5673ab7 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/PassThroughColumnSetter.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/PassThroughColumnSetter.java @@ -3,9 +3,11 @@ import java.util.Calendar; import java.io.IOException; import java.sql.SQLException; + import org.embulk.spi.time.Timestamp; import org.embulk.output.jdbc.JdbcColumn; import org.embulk.output.jdbc.BatchInsert; +import org.msgpack.value.Value; public class PassThroughColumnSetter extends ColumnSetter @@ -55,4 +57,10 @@ public void timestampValue(Timestamp v) throws IOException, SQLException { batch.setSqlTimestamp(v, calendar); } + + @Override + public void jsonValue(Value v) throws IOException, SQLException + { + batch.setString(v.toJson()); + } } diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/ShortColumnSetter.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/ShortColumnSetter.java index fe84a203..1b8cd4a5 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/ShortColumnSetter.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/ShortColumnSetter.java @@ -3,10 +3,13 @@ import java.io.IOException; import java.sql.SQLException; import java.math.RoundingMode; + import com.google.common.math.DoubleMath; + import org.embulk.spi.time.Timestamp; import org.embulk.output.jdbc.JdbcColumn; import org.embulk.output.jdbc.BatchInsert; +import org.msgpack.value.Value; public class ShortColumnSetter extends ColumnSetter @@ -72,4 +75,10 @@ public void timestampValue(Timestamp v) throws IOException, SQLException { defaultValue.setShort(); } + + @Override + public void jsonValue(Value v) throws IOException, SQLException + { + defaultValue.setShort(); + } } diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/SkipColumnSetter.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/SkipColumnSetter.java index 1391db10..9a7a127f 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/SkipColumnSetter.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/SkipColumnSetter.java @@ -2,6 +2,7 @@ import org.embulk.spi.time.Timestamp; import org.embulk.output.jdbc.BatchInsert; +import org.msgpack.value.Value; public class SkipColumnSetter extends ColumnSetter @@ -40,4 +41,9 @@ public void timestampValue(Timestamp v) public void nullValue() { } + + @Override + public void jsonValue(Value v) + { + } } diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/SqlDateColumnSetter.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/SqlDateColumnSetter.java index 8fa93ee9..8b0a0a0a 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/SqlDateColumnSetter.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/SqlDateColumnSetter.java @@ -3,9 +3,11 @@ import java.util.Calendar; import java.io.IOException; import java.sql.SQLException; + import org.embulk.spi.time.Timestamp; import org.embulk.output.jdbc.JdbcColumn; import org.embulk.output.jdbc.BatchInsert; +import org.msgpack.value.Value; public class SqlDateColumnSetter extends ColumnSetter @@ -55,4 +57,10 @@ public void timestampValue(Timestamp v) throws IOException, SQLException { batch.setSqlDate(v, calendar); } + + @Override + public void jsonValue(Value v) throws IOException, SQLException + { + defaultValue.setSqlDate(); + } } diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/SqlTimeColumnSetter.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/SqlTimeColumnSetter.java index dd6a0949..188b264c 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/SqlTimeColumnSetter.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/SqlTimeColumnSetter.java @@ -3,9 +3,11 @@ import java.util.Calendar; import java.io.IOException; import java.sql.SQLException; + import org.embulk.spi.time.Timestamp; import org.embulk.output.jdbc.JdbcColumn; import org.embulk.output.jdbc.BatchInsert; +import org.msgpack.value.Value; public class SqlTimeColumnSetter extends ColumnSetter @@ -55,4 +57,10 @@ public void timestampValue(Timestamp v) throws IOException, SQLException { batch.setSqlTime(v, calendar); } + + @Override + public void jsonValue(Value v) throws IOException, SQLException + { + defaultValue.setSqlTime(); + } } diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/SqlTimestampColumnSetter.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/SqlTimestampColumnSetter.java index b1cb3301..b2ffc816 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/SqlTimestampColumnSetter.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/SqlTimestampColumnSetter.java @@ -3,9 +3,11 @@ import java.util.Calendar; import java.io.IOException; import java.sql.SQLException; + import org.embulk.spi.time.Timestamp; import org.embulk.output.jdbc.JdbcColumn; import org.embulk.output.jdbc.BatchInsert; +import org.msgpack.value.Value; public class SqlTimestampColumnSetter extends ColumnSetter @@ -55,4 +57,10 @@ public void timestampValue(Timestamp v) throws IOException, SQLException { batch.setSqlTimestamp(v, calendar); } + + @Override + public void jsonValue(Value v) throws IOException, SQLException + { + defaultValue.setSqlTimestamp(); + } } diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/StringColumnSetter.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/StringColumnSetter.java index 51be4921..1459f18a 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/StringColumnSetter.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/StringColumnSetter.java @@ -2,10 +2,12 @@ import java.io.IOException; import java.sql.SQLException; + import org.embulk.spi.time.Timestamp; import org.embulk.spi.time.TimestampFormatter; import org.embulk.output.jdbc.JdbcColumn; import org.embulk.output.jdbc.BatchInsert; +import org.msgpack.value.Value; public class StringColumnSetter extends ColumnSetter @@ -55,4 +57,10 @@ public void timestampValue(Timestamp v) throws IOException, SQLException { batch.setString(timestampFormatter.format(v)); } + + @Override + public void jsonValue(Value v) throws IOException, SQLException + { + batch.setString(v.toJson()); + } } From 9fa2460178bdeb4cd911f5d946eda58ddf38bdaa Mon Sep 17 00:00:00 2001 From: hito4t Date: Tue, 5 Apr 2016 11:40:16 +0900 Subject: [PATCH 2/6] Support json --- .../output/jdbc/setter/JsonColumnSetter.java | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/JsonColumnSetter.java diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/JsonColumnSetter.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/JsonColumnSetter.java new file mode 100644 index 00000000..6c93375f --- /dev/null +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/setter/JsonColumnSetter.java @@ -0,0 +1,61 @@ +package org.embulk.output.jdbc.setter; + +import java.io.IOException; +import java.sql.SQLException; + +import org.embulk.spi.time.Timestamp; +import org.embulk.output.jdbc.JdbcColumn; +import org.embulk.output.jdbc.BatchInsert; +import org.msgpack.value.Value; + +public class JsonColumnSetter + extends ColumnSetter +{ + public JsonColumnSetter(BatchInsert batch, JdbcColumn column, + DefaultValueSetter defaultValue) + { + super(batch, column, defaultValue); + } + + @Override + public void nullValue() throws IOException, SQLException + { + defaultValue.setJson(); + } + + @Override + public void booleanValue(boolean v) throws IOException, SQLException + { + defaultValue.setJson(); + } + + @Override + public void longValue(long v) throws IOException, SQLException + { + defaultValue.setJson(); + } + + @Override + public void doubleValue(double v) throws IOException, SQLException + { + defaultValue.setJson(); + } + + @Override + public void stringValue(String v) throws IOException, SQLException + { + defaultValue.setJson(); + } + + @Override + public void timestampValue(Timestamp v) throws IOException, SQLException + { + defaultValue.setJson(); + } + + @Override + public void jsonValue(Value v) throws IOException, SQLException { + batch.setString(v.toJson()); + } +} + From fc38c81b6706e8686bc4359c26c86632a719ea6e Mon Sep 17 00:00:00 2001 From: hito4t Date: Tue, 5 Apr 2016 11:54:39 +0900 Subject: [PATCH 3/6] Support JSON/JSONB type of PostgreSQL --- .../embulk/output/PostgreSQLOutputPlugin.java | 32 ++++++++++++------- .../setter/PostgreSQLColumnSetterFactory.java | 30 +++++++++++++++++ 2 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 embulk-output-postgresql/src/main/java/org/embulk/output/postgresql/setter/PostgreSQLColumnSetterFactory.java diff --git a/embulk-output-postgresql/src/main/java/org/embulk/output/PostgreSQLOutputPlugin.java b/embulk-output-postgresql/src/main/java/org/embulk/output/PostgreSQLOutputPlugin.java index 3b2f8b33..ef996d5a 100644 --- a/embulk-output-postgresql/src/main/java/org/embulk/output/PostgreSQLOutputPlugin.java +++ b/embulk-output-postgresql/src/main/java/org/embulk/output/PostgreSQLOutputPlugin.java @@ -1,25 +1,29 @@ package org.embulk.output; -import java.util.List; -import java.util.Properties; import java.io.IOException; import java.sql.SQLException; -import com.google.common.base.Optional; -import com.google.common.collect.ImmutableSet; +import java.sql.Types; +import java.util.List; +import java.util.Properties; + import org.embulk.config.Config; import org.embulk.config.ConfigDefault; import org.embulk.output.jdbc.AbstractJdbcOutputPlugin; import org.embulk.output.jdbc.BatchInsert; -import org.embulk.output.postgresql.PostgreSQLOutputConnector; +import org.embulk.output.jdbc.JdbcColumn; +import org.embulk.output.jdbc.JdbcSchema; +import org.embulk.output.jdbc.setter.ColumnSetterFactory; import org.embulk.output.postgresql.PostgreSQLCopyBatchInsert; +import org.embulk.output.postgresql.PostgreSQLOutputConnector; +import org.embulk.output.postgresql.setter.PostgreSQLColumnSetterFactory; +import org.embulk.spi.Column; +import org.embulk.spi.ColumnVisitor; +import org.embulk.spi.Schema; +import org.joda.time.DateTimeZone; +import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; -import java.sql.Types; -import org.embulk.spi.Schema; -import org.embulk.spi.ColumnVisitor; -import org.embulk.spi.Column; -import org.embulk.output.jdbc.JdbcColumn; -import org.embulk.output.jdbc.JdbcSchema; +import com.google.common.collect.ImmutableSet; public class PostgreSQLOutputPlugin extends AbstractJdbcOutputPlugin @@ -168,4 +172,10 @@ public void timestampColumn(Column column) } return new JdbcSchema(columns.build()); } + + @Override + protected ColumnSetterFactory newColumnSetterFactory(BatchInsert batch, DateTimeZone defaultTimeZone) + { + return new PostgreSQLColumnSetterFactory(batch, defaultTimeZone); + } } diff --git a/embulk-output-postgresql/src/main/java/org/embulk/output/postgresql/setter/PostgreSQLColumnSetterFactory.java b/embulk-output-postgresql/src/main/java/org/embulk/output/postgresql/setter/PostgreSQLColumnSetterFactory.java new file mode 100644 index 00000000..5e4c6fce --- /dev/null +++ b/embulk-output-postgresql/src/main/java/org/embulk/output/postgresql/setter/PostgreSQLColumnSetterFactory.java @@ -0,0 +1,30 @@ +package org.embulk.output.postgresql.setter; + +import org.embulk.output.jdbc.BatchInsert; +import org.embulk.output.jdbc.JdbcColumn; +import org.embulk.output.jdbc.JdbcColumnOption; +import org.embulk.output.jdbc.setter.ColumnSetter; +import org.embulk.output.jdbc.setter.ColumnSetterFactory; +import org.embulk.output.jdbc.setter.JsonColumnSetter; +import org.joda.time.DateTimeZone; + +public class PostgreSQLColumnSetterFactory + extends ColumnSetterFactory +{ + public PostgreSQLColumnSetterFactory(BatchInsert batch, DateTimeZone defaultTimeZone) + { + super(batch, defaultTimeZone); + } + + @Override + public ColumnSetter newCoalesceColumnSetter(JdbcColumn column, JdbcColumnOption option) + { + if (column.getSimpleTypeName().equalsIgnoreCase("json") || column.getSimpleTypeName().equalsIgnoreCase("jsonb")) { + // actually "JSON"/"JSONB" + return new JsonColumnSetter(batch, column, newDefaultValueSetter(column, option)); + } else { + return super.newCoalesceColumnSetter(column, option); + } + } + +} From 83ce3137cfc91507e0e881aa6b43e5aae858d70f Mon Sep 17 00:00:00 2001 From: hito4t Date: Tue, 5 Apr 2016 11:58:07 +0900 Subject: [PATCH 4/6] Add json type --- README.md | 2 +- embulk-output-mysql/README.md | 2 +- embulk-output-oracle/README.md | 2 +- embulk-output-postgresql/README.md | 2 +- embulk-output-redshift/README.md | 2 +- embulk-output-sqlserver/README.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index db70fcfb..ff5c7fe8 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ See [embulk-output-sqlserver](embulk-output-sqlserver/). - **default_timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp into a SQL string. This default_timezone option is used to control the timezone. You can overwrite timezone for each columns using column_options option. (string, default: `UTC`) - **column_options**: advanced: a key-value pairs where key is a column name and value is options for the column. - **type**: type of a column when this plugin creates new tables (e.g. `VARCHAR(255)`, `INTEGER NOT NULL UNIQUE`). This used when this plugin creates intermediate tables (insert and truncate_insert modes), when it creates the target table (replace mode), and when it creates nonexistent target table automatically. (string, default: depends on input column type. `BIGINT` if input column type is long, `BOOLEAN` if boolean, `DOUBLE PRECISION` if double, `CLOB` if string, `TIMESTAMP` if timestamp) - - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on input column type. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `null`, `pass`) + - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on input column type. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `json`, `null`, `pass`) - **timestamp_format**: If input column type (embulk type) is timestamp and value_type is `string` or `nstring`, this plugin needs to format the timestamp value into a string. This timestamp_format option is used to control the format of the timestamp. (string, default: `%Y-%m-%d %H:%M:%S.%6N`) - **timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp value into a SQL string. In this cases, this timezone option is used to control the timezone. (string, value of default_timezone option is used by default) diff --git a/embulk-output-mysql/README.md b/embulk-output-mysql/README.md index 1220f948..3a6c96a7 100644 --- a/embulk-output-mysql/README.md +++ b/embulk-output-mysql/README.md @@ -22,7 +22,7 @@ MySQL output plugins for Embulk loads records to MySQL. - **default_timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp into a SQL string. This default_timezone option is used to control the timezone. You can overwrite timezone for each columns using column_options option. (string, default: `UTC`) - **column_options**: advanced: a key-value pairs where key is a column name and value is options for the column. - **type**: type of a column when this plugin creates new tables (e.g. `VARCHAR(255)`, `INTEGER NOT NULL UNIQUE`). This used when this plugin creates intermediate tables (insert, insert_truncate and merge modes), when it creates the target table (insert_direct, merge_direct and replace modes), and when it creates nonexistent target table automatically. (string, default: depends on input column type. `BIGINT` if input column type is long, `BOOLEAN` if boolean, `DOUBLE PRECISION` if double, `CLOB` if string, `TIMESTAMP` if timestamp) - - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on input column type. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `null`, `pass`) + - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on input column type. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `json`, `null`, `pass`) - **timestamp_format**: If input column type (embulk type) is timestamp and value_type is `string` or `nstring`, this plugin needs to format the timestamp value into a string. This timestamp_format option is used to control the format of the timestamp. (string, default: `%Y-%m-%d %H:%M:%S.%6N`) - **timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp value into a SQL string. In this cases, this timezone option is used to control the timezone. (string, value of default_timezone option is used by default) diff --git a/embulk-output-oracle/README.md b/embulk-output-oracle/README.md index b9333ada..a9c6fb22 100644 --- a/embulk-output-oracle/README.md +++ b/embulk-output-oracle/README.md @@ -25,7 +25,7 @@ Oracle output plugins for Embulk loads records to Oracle. - **default_timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp into a SQL string. This default_timezone option is used to control the timezone. You can overwrite timezone for each columns using column_options option. (string, default: `UTC`) - **column_options**: advanced: a key-value pairs where key is a column name and value is options for the column. - **type**: type of a column when this plugin creates new tables (e.g. `VARCHAR(255)`, `INTEGER NOT NULL UNIQUE`). This used when this plugin creates intermediate tables (insert, truncate_insert and merge modes), when it creates the target table (insert_direct and replace modes), and when it creates nonexistent target table automatically. (string, default: depends on input column type. `BIGINT` if input column type is long, `BOOLEAN` if boolean, `DOUBLE PRECISION` if double, `CLOB` if string, `TIMESTAMP` if timestamp) - - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on input column type. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `null`, `pass`) + - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on input column type. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `json`, `null`, `pass`) - **timestamp_format**: If input column type (embulk type) is timestamp and value_type is `string` or `nstring`, this plugin needs to format the timestamp value into a string. This timestamp_format option is used to control the format of the timestamp. (string, default: `%Y-%m-%d %H:%M:%S.%6N`) - **timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp value into a SQL string. In this cases, this timezone option is used to control the timezone. (string, value of default_timezone option is used by default) diff --git a/embulk-output-postgresql/README.md b/embulk-output-postgresql/README.md index 80fff429..8af68a72 100644 --- a/embulk-output-postgresql/README.md +++ b/embulk-output-postgresql/README.md @@ -25,7 +25,7 @@ PostgreSQL output plugins for Embulk loads records to PostgreSQL. - **default_timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp into a SQL string. This default_timezone option is used to control the timezone. You can overwrite timezone for each columns using column_options option. (string, default: `UTC`) - **column_options**: advanced: a key-value pairs where key is a column name and value is options for the column. - **type**: type of a column when this plugin creates new tables (e.g. `VARCHAR(255)`, `INTEGER NOT NULL UNIQUE`). This used when this plugin creates intermediate tables (insert, truncate_insert and merge modes), when it creates the target table (insert_direct and replace modes), and when it creates nonexistent target table automatically. (string, default: depends on input column type. `BIGINT` if input column type is long, `BOOLEAN` if boolean, `DOUBLE PRECISION` if double, `CLOB` if string, `TIMESTAMP WITH TIME ZONE` if timestamp) - - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on input column type. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `null`, `pass`) + - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on input column type. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `json`, `null`, `pass`) - **timestamp_format**: If input column type (embulk type) is timestamp and value_type is `string` or `nstring`, this plugin needs to format the timestamp value into a string. This timestamp_format option is used to control the format of the timestamp. (string, default: `%Y-%m-%d %H:%M:%S.%6N`) - **timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp value into a SQL string. In this cases, this timezone option is used to control the timezone. (string, value of default_timezone option is used by default) diff --git a/embulk-output-redshift/README.md b/embulk-output-redshift/README.md index 7631d69c..3114fcbe 100644 --- a/embulk-output-redshift/README.md +++ b/embulk-output-redshift/README.md @@ -28,7 +28,7 @@ Redshift output plugins for Embulk loads records to Redshift. - **default_timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp into a SQL string. This default_timezone option is used to control the timezone. You can overwrite timezone for each columns using column_options option. (string, default: `UTC`) - **column_options**: advanced: a key-value pairs where key is a column name and value is options for the column. - **type**: type of a column when this plugin creates new tables (e.g. `VARCHAR(255)`, `INTEGER NOT NULL UNIQUE`). This used when this plugin creates intermediate tables (insert, truncate_insert and merge modes), when it creates the target table (insert_direct and replace modes), and when it creates nonexistent target table automatically. (string, default: depends on input column type. `BIGINT` if input column type is long, `BOOLEAN` if boolean, `DOUBLE PRECISION` if double, `CLOB` if string, `TIMESTAMP` if timestamp) - - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on input column type. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `null`, `pass`) + - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on input column type. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `json`, `null`, `pass`) - **timestamp_format**: If input column type (embulk type) is timestamp and value_type is `string` or `nstring`, this plugin needs to format the timestamp value into a string. This timestamp_format option is used to control the format of the timestamp. (string, default: `%Y-%m-%d %H:%M:%S.%6N`) - **timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp value into a SQL string. In this cases, this timezone option is used to control the timezone. (string, value of default_timezone option is used by default) diff --git a/embulk-output-sqlserver/README.md b/embulk-output-sqlserver/README.md index 76b3d2f2..a6f90af2 100644 --- a/embulk-output-sqlserver/README.md +++ b/embulk-output-sqlserver/README.md @@ -31,7 +31,7 @@ embulk "-J-Djava.library.path=C:\drivers" run input-sqlserver.yml - **default_timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp into a SQL string. This default_timezone option is used to control the timezone. You can overwrite timezone for each columns using column_options option. (string, default: `UTC`) - **column_options**: advanced: a key-value pairs where key is a column name and value is options for the column. - **type**: type of a column when this plugin creates new tables (e.g. `VARCHAR(255)`, `INTEGER NOT NULL UNIQUE`). This used when this plugin creates intermediate tables (insert, insert_truncate and merge modes), when it creates the target table (insert_direct, merge_direct and replace modes), and when it creates nonexistent target table automatically. (string, default: depends on input column type. `BIGINT` if input column type is long, `BOOLEAN` if boolean, `DOUBLE PRECISION` if double, `CLOB` if string, `TIMESTAMP` if timestamp) - - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on input column type. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `null`, `pass`) + - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on input column type. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `json`, `null`, `pass`) - **timestamp_format**: If input column type (embulk type) is timestamp and value_type is `string` or `nstring`, this plugin needs to format the timestamp value into a string. This timestamp_format option is used to control the format of the timestamp. (string, default: `%Y-%m-%d %H:%M:%S.%6N`) - **timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp value into a SQL string. In this cases, this timezone option is used to control the timezone. (string, value of default_timezone option is used by default) From b8ff5b91162ca29eaba16367282f2093131d696e Mon Sep 17 00:00:00 2001 From: hito4t Date: Tue, 5 Apr 2016 13:38:47 +0900 Subject: [PATCH 5/6] Update README for value_type --- .gitignore | 1 + README.md | 2 +- embulk-output-mysql/README.md | 2 +- embulk-output-oracle/README.md | 2 +- embulk-output-postgresql/README.md | 2 +- embulk-output-redshift/README.md | 2 +- embulk-output-sqlserver/README.md | 2 +- 7 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index f1bd7a03..38176cba 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ classpath/ build/ .idea +/out/ diff --git a/README.md b/README.md index ff5c7fe8..e40d81dc 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ See [embulk-output-sqlserver](embulk-output-sqlserver/). - **default_timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp into a SQL string. This default_timezone option is used to control the timezone. You can overwrite timezone for each columns using column_options option. (string, default: `UTC`) - **column_options**: advanced: a key-value pairs where key is a column name and value is options for the column. - **type**: type of a column when this plugin creates new tables (e.g. `VARCHAR(255)`, `INTEGER NOT NULL UNIQUE`). This used when this plugin creates intermediate tables (insert and truncate_insert modes), when it creates the target table (replace mode), and when it creates nonexistent target table automatically. (string, default: depends on input column type. `BIGINT` if input column type is long, `BOOLEAN` if boolean, `DOUBLE PRECISION` if double, `CLOB` if string, `TIMESTAMP` if timestamp) - - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on input column type. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `json`, `null`, `pass`) + - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on the sql type of the column. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `json`, `null`, `pass`) - **timestamp_format**: If input column type (embulk type) is timestamp and value_type is `string` or `nstring`, this plugin needs to format the timestamp value into a string. This timestamp_format option is used to control the format of the timestamp. (string, default: `%Y-%m-%d %H:%M:%S.%6N`) - **timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp value into a SQL string. In this cases, this timezone option is used to control the timezone. (string, value of default_timezone option is used by default) diff --git a/embulk-output-mysql/README.md b/embulk-output-mysql/README.md index 3a6c96a7..6f647d11 100644 --- a/embulk-output-mysql/README.md +++ b/embulk-output-mysql/README.md @@ -22,7 +22,7 @@ MySQL output plugins for Embulk loads records to MySQL. - **default_timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp into a SQL string. This default_timezone option is used to control the timezone. You can overwrite timezone for each columns using column_options option. (string, default: `UTC`) - **column_options**: advanced: a key-value pairs where key is a column name and value is options for the column. - **type**: type of a column when this plugin creates new tables (e.g. `VARCHAR(255)`, `INTEGER NOT NULL UNIQUE`). This used when this plugin creates intermediate tables (insert, insert_truncate and merge modes), when it creates the target table (insert_direct, merge_direct and replace modes), and when it creates nonexistent target table automatically. (string, default: depends on input column type. `BIGINT` if input column type is long, `BOOLEAN` if boolean, `DOUBLE PRECISION` if double, `CLOB` if string, `TIMESTAMP` if timestamp) - - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on input column type. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `json`, `null`, `pass`) + - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on the sql type of the column. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `json`, `null`, `pass`) - **timestamp_format**: If input column type (embulk type) is timestamp and value_type is `string` or `nstring`, this plugin needs to format the timestamp value into a string. This timestamp_format option is used to control the format of the timestamp. (string, default: `%Y-%m-%d %H:%M:%S.%6N`) - **timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp value into a SQL string. In this cases, this timezone option is used to control the timezone. (string, value of default_timezone option is used by default) diff --git a/embulk-output-oracle/README.md b/embulk-output-oracle/README.md index a9c6fb22..d1485e36 100644 --- a/embulk-output-oracle/README.md +++ b/embulk-output-oracle/README.md @@ -25,7 +25,7 @@ Oracle output plugins for Embulk loads records to Oracle. - **default_timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp into a SQL string. This default_timezone option is used to control the timezone. You can overwrite timezone for each columns using column_options option. (string, default: `UTC`) - **column_options**: advanced: a key-value pairs where key is a column name and value is options for the column. - **type**: type of a column when this plugin creates new tables (e.g. `VARCHAR(255)`, `INTEGER NOT NULL UNIQUE`). This used when this plugin creates intermediate tables (insert, truncate_insert and merge modes), when it creates the target table (insert_direct and replace modes), and when it creates nonexistent target table automatically. (string, default: depends on input column type. `BIGINT` if input column type is long, `BOOLEAN` if boolean, `DOUBLE PRECISION` if double, `CLOB` if string, `TIMESTAMP` if timestamp) - - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on input column type. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `json`, `null`, `pass`) + - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on the sql type of the column. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `json`, `null`, `pass`) - **timestamp_format**: If input column type (embulk type) is timestamp and value_type is `string` or `nstring`, this plugin needs to format the timestamp value into a string. This timestamp_format option is used to control the format of the timestamp. (string, default: `%Y-%m-%d %H:%M:%S.%6N`) - **timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp value into a SQL string. In this cases, this timezone option is used to control the timezone. (string, value of default_timezone option is used by default) diff --git a/embulk-output-postgresql/README.md b/embulk-output-postgresql/README.md index 8af68a72..bbfd4196 100644 --- a/embulk-output-postgresql/README.md +++ b/embulk-output-postgresql/README.md @@ -25,7 +25,7 @@ PostgreSQL output plugins for Embulk loads records to PostgreSQL. - **default_timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp into a SQL string. This default_timezone option is used to control the timezone. You can overwrite timezone for each columns using column_options option. (string, default: `UTC`) - **column_options**: advanced: a key-value pairs where key is a column name and value is options for the column. - **type**: type of a column when this plugin creates new tables (e.g. `VARCHAR(255)`, `INTEGER NOT NULL UNIQUE`). This used when this plugin creates intermediate tables (insert, truncate_insert and merge modes), when it creates the target table (insert_direct and replace modes), and when it creates nonexistent target table automatically. (string, default: depends on input column type. `BIGINT` if input column type is long, `BOOLEAN` if boolean, `DOUBLE PRECISION` if double, `CLOB` if string, `TIMESTAMP WITH TIME ZONE` if timestamp) - - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on input column type. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `json`, `null`, `pass`) + - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on the sql type of the column. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `json`, `null`, `pass`) - **timestamp_format**: If input column type (embulk type) is timestamp and value_type is `string` or `nstring`, this plugin needs to format the timestamp value into a string. This timestamp_format option is used to control the format of the timestamp. (string, default: `%Y-%m-%d %H:%M:%S.%6N`) - **timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp value into a SQL string. In this cases, this timezone option is used to control the timezone. (string, value of default_timezone option is used by default) diff --git a/embulk-output-redshift/README.md b/embulk-output-redshift/README.md index 3114fcbe..0168b176 100644 --- a/embulk-output-redshift/README.md +++ b/embulk-output-redshift/README.md @@ -28,7 +28,7 @@ Redshift output plugins for Embulk loads records to Redshift. - **default_timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp into a SQL string. This default_timezone option is used to control the timezone. You can overwrite timezone for each columns using column_options option. (string, default: `UTC`) - **column_options**: advanced: a key-value pairs where key is a column name and value is options for the column. - **type**: type of a column when this plugin creates new tables (e.g. `VARCHAR(255)`, `INTEGER NOT NULL UNIQUE`). This used when this plugin creates intermediate tables (insert, truncate_insert and merge modes), when it creates the target table (insert_direct and replace modes), and when it creates nonexistent target table automatically. (string, default: depends on input column type. `BIGINT` if input column type is long, `BOOLEAN` if boolean, `DOUBLE PRECISION` if double, `CLOB` if string, `TIMESTAMP` if timestamp) - - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on input column type. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `json`, `null`, `pass`) + - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on the sql type of the column. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `json`, `null`, `pass`) - **timestamp_format**: If input column type (embulk type) is timestamp and value_type is `string` or `nstring`, this plugin needs to format the timestamp value into a string. This timestamp_format option is used to control the format of the timestamp. (string, default: `%Y-%m-%d %H:%M:%S.%6N`) - **timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp value into a SQL string. In this cases, this timezone option is used to control the timezone. (string, value of default_timezone option is used by default) diff --git a/embulk-output-sqlserver/README.md b/embulk-output-sqlserver/README.md index a6f90af2..fa4f2d8c 100644 --- a/embulk-output-sqlserver/README.md +++ b/embulk-output-sqlserver/README.md @@ -31,7 +31,7 @@ embulk "-J-Djava.library.path=C:\drivers" run input-sqlserver.yml - **default_timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp into a SQL string. This default_timezone option is used to control the timezone. You can overwrite timezone for each columns using column_options option. (string, default: `UTC`) - **column_options**: advanced: a key-value pairs where key is a column name and value is options for the column. - **type**: type of a column when this plugin creates new tables (e.g. `VARCHAR(255)`, `INTEGER NOT NULL UNIQUE`). This used when this plugin creates intermediate tables (insert, insert_truncate and merge modes), when it creates the target table (insert_direct, merge_direct and replace modes), and when it creates nonexistent target table automatically. (string, default: depends on input column type. `BIGINT` if input column type is long, `BOOLEAN` if boolean, `DOUBLE PRECISION` if double, `CLOB` if string, `TIMESTAMP` if timestamp) - - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on input column type. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `json`, `null`, `pass`) + - **value_type**: This plugin converts input column type (embulk type) into a database type to build a INSERT statement. This value_type option controls the type of the value in a INSERT statement. (string, default: depends on the sql type of the column. Available values options are: `byte`, `short`, `int`, `long`, `double`, `float`, `boolean`, `string`, `nstring`, `date`, `time`, `timestamp`, `decimal`, `json`, `null`, `pass`) - **timestamp_format**: If input column type (embulk type) is timestamp and value_type is `string` or `nstring`, this plugin needs to format the timestamp value into a string. This timestamp_format option is used to control the format of the timestamp. (string, default: `%Y-%m-%d %H:%M:%S.%6N`) - **timezone**: If input column type (embulk type) is timestamp, this plugin needs to format the timestamp value into a SQL string. In this cases, this timezone option is used to control the timezone. (string, value of default_timezone option is used by default) From 21957ac6c595a81b13c8bb39405be09fc99d0845 Mon Sep 17 00:00:00 2001 From: hito4t Date: Mon, 11 Apr 2016 10:57:18 +0900 Subject: [PATCH 6/6] rollback --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 38176cba..f1bd7a03 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,3 @@ classpath/ build/ .idea -/out/