embulk-input-mysql 0.9.3 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +12 -2
- data/build.gradle +1 -1
- data/classpath/embulk-input-jdbc-0.10.0.jar +0 -0
- data/classpath/embulk-input-mysql-0.10.0.jar +0 -0
- data/src/main/java/org/embulk/input/mysql/getter/MySQLColumnGetterFactory.java +13 -1
- data/src/test/java/org/embulk/input/mysql/BasicTest.java +9 -0
- data/src/test/java/org/embulk/input/mysql/MySQLColumnGetterFactoryTest.java +70 -0
- data/src/test/java/org/embulk/input/mysql/MySQLTests.java +13 -1
- data/src/test/java/org/embulk/input/mysql/OptionTest.java +93 -0
- data/src/test/resources/org/embulk/input/mysql/test/expect/basic/setup.sql +4 -1
- data/src/test/resources/org/embulk/input/mysql/test/expect/basic/test_boolean_expected.csv +2 -2
- data/src/test/resources/org/embulk/input/mysql/test/expect/basic/test_double_expected.csv +2 -2
- data/src/test/resources/org/embulk/input/mysql/test/expect/basic/test_expected.csv +2 -2
- data/src/test/resources/org/embulk/input/mysql/test/expect/basic/test_long_expected.csv +2 -2
- data/src/test/resources/org/embulk/input/mysql/test/expect/basic/test_string_expected.csv +2 -2
- data/src/test/resources/org/embulk/input/mysql/test/expect/basic/test_timestamp1_expected.csv +2 -2
- data/src/test/resources/org/embulk/input/mysql/test/expect/basic/test_timestamp2_expected.csv +2 -2
- data/src/test/resources/org/embulk/input/mysql/test/expect/basic/test_timestamp3_expected.csv +2 -2
- data/src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_decimal_expected.csv +2 -2
- data/src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_json_config.yml +3 -0
- data/src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_json_expected.csv +2 -0
- data/src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_json_expected.diff +2 -0
- data/src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_string_config.yml +1 -0
- data/src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_string_expected.csv +2 -2
- data/src/test/resources/org/embulk/input/mysql/test/expect/option/after_select.yml +3 -0
- data/src/test/resources/org/embulk/input/mysql/test/expect/option/after_select_expected.csv +3 -0
- data/src/test/resources/org/embulk/input/mysql/test/expect/option/before_select.yml +3 -0
- data/src/test/resources/org/embulk/input/mysql/test/expect/option/before_select_expected.csv +3 -0
- data/src/test/resources/org/embulk/input/mysql/test/expect/option/before_setup.yml +6 -0
- data/src/test/resources/org/embulk/input/mysql/test/expect/option/before_setup_expected.csv +2 -0
- data/src/test/resources/org/embulk/input/mysql/test/expect/option/column_options.yml +5 -0
- data/src/test/resources/org/embulk/input/mysql/test/expect/option/column_options_expected.csv +3 -0
- data/src/test/resources/org/embulk/input/mysql/test/expect/option/default_column_options.yml +6 -0
- data/src/test/resources/org/embulk/input/mysql/test/expect/option/default_column_options_expected.csv +3 -0
- data/src/test/resources/org/embulk/input/mysql/test/expect/option/expected1.csv +4 -0
- data/src/test/resources/org/embulk/input/mysql/test/expect/option/input.yml +2 -0
- data/src/test/resources/org/embulk/input/mysql/test/expect/option/setup.sql +29 -0
- metadata +23 -5
- data/classpath/embulk-input-jdbc-0.9.3.jar +0 -0
- data/classpath/embulk-input-mysql-0.9.3.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cc441427089a73c25d30442c2683f881bebcb3d6297d3ef062ebb3a069912a49
|
4
|
+
data.tar.gz: c9dba75abd31ef6fff03aa0e7a5fb3938e8df75ef3202ddfedebf106419e4902
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7105db953dedce4d4b84bffcdb9219cdc52dd889592a6907a3b3c2b5ca52d821ec29029d2f9765bbce29779f1fd0df193adc2c86029eb08dcde84065db697fe9
|
7
|
+
data.tar.gz: 75a2c458dfb3b43d0d0321b145c5d8db6789d9a3408110d3a807e358f9f15d40e032cb5f9e6e20258f0ac0f8b51be8921739770c098805a2d441e8cb2ca19948
|
data/README.md
CHANGED
@@ -7,6 +7,10 @@ MySQL input plugin for Embulk loads records from MySQL.
|
|
7
7
|
* **Plugin type**: input
|
8
8
|
* **Resume supported**: yes
|
9
9
|
|
10
|
+
**[WARNING!]**
|
11
|
+
|
12
|
+
- The default embulk type for MySQL JSON type will be changed from `string` to `json`.
|
13
|
+
|
10
14
|
## Configuration
|
11
15
|
|
12
16
|
- **driver_path**: path to the jar file of the MySQL JDBC driver. If not set, the bundled JDBC driver (MySQL Connector/J 5.1.44) will be used (string). NOTE: embulk-input-mysql 0.9.0 upgraded the bundled MySQL Connector/J version from 5.1.34 to 5.1.44 . And set useLegacyDatetimeCode=false by default in order to get correct datetime value when the server timezone and the client timezone are different. Set useLegacyDatetimeCode=true if you need to get datetime value same as older embulk-input-mysql.
|
@@ -41,7 +45,8 @@ MySQL input plugin for Embulk loads records from MySQL.
|
|
41
45
|
- **last_record**: values of the last record for incremental loading (array of objects, default: load all records)
|
42
46
|
- **default_timezone**: If the sql type of a column is `date`/`time`/`datetime` and the embulk type is `string`, column values are formatted int this default_timezone. You can overwrite timezone for each columns using column_options option. (string, default: `UTC`)
|
43
47
|
- **use_legacy_datetime_code**: recommended not to set the property (boolean, default: false). If true, embulk-output-mysql will get wrong datetime values when the server timezone and the client server timezone are different as older embulk-output-mysql did.
|
44
|
-
- **
|
48
|
+
- **default_column_options**: advanced: column_options for each JDBC type as default. key-value pairs where key is a JDBC type (e.g. 'DATE', 'BIGINT') and value is same as column_options's value.
|
49
|
+
- **column_options**: advanced: key-value pairs where key is a column name and value is options for the column.
|
45
50
|
- **value_type**: embulk get values from database as this value_type. Typically, the value_type determines `getXXX` method of `java.sql.PreparedStatement`.
|
46
51
|
(string, default: depends on the sql type of the column. Available values options are: `long`, `double`, `float`, `decimal`, `boolean`, `string`, `json`, `date`, `time`, `timestamp`)
|
47
52
|
- **type**: Column values are converted to this embulk type.
|
@@ -50,6 +55,8 @@ MySQL input plugin for Embulk loads records from MySQL.
|
|
50
55
|
- **timestamp_format**: If the sql type of the column is `date`/`time`/`datetime` and the embulk type is `string`, column values are formatted by this timestamp_format. And if the embulk type is `timestamp`, this timestamp_format may be used in the output plugin. For example, stdout plugin use the timestamp_format, but *csv formatter plugin doesn't use*. (string, default : `%Y-%m-%d` for `date`, `%H:%M:%S` for `time`, `%Y-%m-%d %H:%M:%S` for `timestamp`)
|
51
56
|
- **timezone**: If the sql type of the column is `date`/`time`/`datetime` and the embulk type is `string`, column values are formatted in this timezone.
|
52
57
|
(string, value of default_timezone option is used by default)
|
58
|
+
- **before_setup**: if set, this SQL will be executed before setup. You can prepare table for input by this option.
|
59
|
+
- **before_select**: if set, this SQL will be executed before the SELECT query in the same transaction.
|
53
60
|
- **after_select**: if set, this SQL will be executed after the SELECT query in the same transaction.
|
54
61
|
|
55
62
|
|
@@ -86,7 +93,7 @@ Then, it updates `last_record: ` so that next execution uses the updated last_re
|
|
86
93
|
CREATE INDEX embulk_incremental_loading_index ON table (updated_at, id);
|
87
94
|
```
|
88
95
|
|
89
|
-
Recommended usage is to leave `incremental_columns` unset and let this plugin automatically finds an AUTO_INCREMENT primary key. Currently, only strings and
|
96
|
+
Recommended usage is to leave `incremental_columns` unset and let this plugin automatically finds an AUTO_INCREMENT primary key. Currently, only strings, integers, DATETIME and TIMESTAMP are supported as incremental_columns.
|
90
97
|
|
91
98
|
|
92
99
|
## Trouble shooting
|
@@ -178,6 +185,9 @@ in:
|
|
178
185
|
table: "my_table"
|
179
186
|
select: "col1, col2, col3"
|
180
187
|
where: "col4 != 'a'"
|
188
|
+
default_column_options:
|
189
|
+
TIMESTAMP: { type: string, timestamp_format: "%Y/%m/%d %H:%M:%S", timezone: "+0900"}
|
190
|
+
BIGINT: { type: string }
|
181
191
|
column_options:
|
182
192
|
col1: {type: long}
|
183
193
|
col3: {type: string, timestamp_format: "%Y/%m/%d", timezone: "+0900"}
|
data/build.gradle
CHANGED
Binary file
|
Binary file
|
@@ -1,6 +1,5 @@
|
|
1
1
|
package org.embulk.input.mysql.getter;
|
2
2
|
|
3
|
-
import com.google.common.base.Optional;
|
4
3
|
import org.embulk.config.ConfigException;
|
5
4
|
import org.embulk.input.jdbc.AbstractJdbcInputPlugin.PluginTask;
|
6
5
|
import org.embulk.input.jdbc.JdbcColumn;
|
@@ -8,8 +7,10 @@ import org.embulk.input.jdbc.JdbcColumnOption;
|
|
8
7
|
import org.embulk.input.jdbc.JdbcInputConnection;
|
9
8
|
import org.embulk.input.jdbc.getter.ColumnGetter;
|
10
9
|
import org.embulk.input.jdbc.getter.ColumnGetterFactory;
|
10
|
+
import org.embulk.input.jdbc.getter.JsonColumnGetter;
|
11
11
|
import org.embulk.input.mysql.MySQLInputConnection;
|
12
12
|
import org.embulk.spi.PageBuilder;
|
13
|
+
import org.embulk.spi.type.Types;
|
13
14
|
import org.joda.time.DateTimeZone;
|
14
15
|
|
15
16
|
import java.util.TimeZone;
|
@@ -54,8 +55,19 @@ public class MySQLColumnGetterFactory
|
|
54
55
|
else { // TIMESTAMP
|
55
56
|
return new MySQLTimestampTimestampIncrementalHandler(sessionTimeZone, getter);
|
56
57
|
}
|
58
|
+
case "JSON":
|
59
|
+
return new JsonColumnGetter(to, Types.JSON);
|
57
60
|
default:
|
58
61
|
return getter;
|
59
62
|
}
|
60
63
|
}
|
64
|
+
|
65
|
+
@Override
|
66
|
+
protected String sqlTypeToValueType(JdbcColumn column, int sqlType)
|
67
|
+
{
|
68
|
+
if ("json".equals(column.getTypeName())) {
|
69
|
+
return "json";
|
70
|
+
}
|
71
|
+
return super.sqlTypeToValueType(column, sqlType);
|
72
|
+
}
|
61
73
|
}
|
@@ -134,4 +134,13 @@ public class BasicTest
|
|
134
134
|
assertThat(readSortedFile(out1), is(readResource("test_valuetype_decimal_expected.csv")));
|
135
135
|
assertThat(result1.getConfigDiff(), is((ConfigDiff) loadYamlResource(embulk, "test_valuetype_decimal_expected.diff")));
|
136
136
|
}
|
137
|
+
|
138
|
+
@Test
|
139
|
+
public void testValueTypeJson() throws Exception
|
140
|
+
{
|
141
|
+
Path out1 = embulk.createTempFile("csv");
|
142
|
+
TestingEmbulk.RunResult result1 = embulk.runInput(baseConfig.merge(loadYamlResource(embulk, "test_valuetype_json_config.yml")), out1);
|
143
|
+
assertThat(readSortedFile(out1), is(readResource("test_valuetype_json_expected.csv")));
|
144
|
+
assertThat(result1.getConfigDiff(), is((ConfigDiff) loadYamlResource(embulk, "test_valuetype_json_expected.diff")));
|
145
|
+
}
|
137
146
|
}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
package org.embulk.input.mysql;
|
2
|
+
|
3
|
+
import com.google.common.base.Optional;
|
4
|
+
import org.embulk.config.TaskSource;
|
5
|
+
import org.embulk.input.jdbc.JdbcColumn;
|
6
|
+
import org.embulk.input.jdbc.JdbcColumnOption;
|
7
|
+
import org.embulk.input.jdbc.getter.ColumnGetterFactory;
|
8
|
+
import org.embulk.input.jdbc.getter.JsonColumnGetter;
|
9
|
+
import org.embulk.input.jdbc.getter.StringColumnGetter;
|
10
|
+
import org.embulk.input.mysql.getter.MySQLColumnGetterFactory;
|
11
|
+
import org.embulk.spi.time.TimestampFormat;
|
12
|
+
import org.embulk.spi.type.Type;
|
13
|
+
import org.joda.time.DateTimeZone;
|
14
|
+
import org.junit.Test;
|
15
|
+
|
16
|
+
import static org.hamcrest.MatcherAssert.assertThat;
|
17
|
+
import static org.hamcrest.core.IsInstanceOf.instanceOf;
|
18
|
+
|
19
|
+
public class MySQLColumnGetterFactoryTest
|
20
|
+
{
|
21
|
+
@Test
|
22
|
+
public void testJsonSupported()
|
23
|
+
{
|
24
|
+
JdbcColumnOption mockColumnOption = new JdbcColumnOption()
|
25
|
+
{
|
26
|
+
@Override
|
27
|
+
public String getValueType()
|
28
|
+
{
|
29
|
+
return "coalesce";
|
30
|
+
}
|
31
|
+
|
32
|
+
@Override
|
33
|
+
public Optional<Type> getType()
|
34
|
+
{
|
35
|
+
return Optional.absent();
|
36
|
+
}
|
37
|
+
|
38
|
+
@Override
|
39
|
+
public Optional<TimestampFormat> getTimestampFormat()
|
40
|
+
{
|
41
|
+
return Optional.absent();
|
42
|
+
}
|
43
|
+
|
44
|
+
@Override
|
45
|
+
public Optional<DateTimeZone> getTimeZone()
|
46
|
+
{
|
47
|
+
return Optional.absent();
|
48
|
+
}
|
49
|
+
|
50
|
+
@Override
|
51
|
+
public void validate()
|
52
|
+
{
|
53
|
+
|
54
|
+
}
|
55
|
+
|
56
|
+
@Override
|
57
|
+
public TaskSource dump()
|
58
|
+
{
|
59
|
+
return null;
|
60
|
+
}
|
61
|
+
};
|
62
|
+
JdbcColumn jsonColumn = new JdbcColumn("any_column_name", "JSON", 1, 0, 0); // 1: CHAR
|
63
|
+
|
64
|
+
ColumnGetterFactory fac = new MySQLColumnGetterFactory(null, null);
|
65
|
+
assertThat(fac.newColumnGetter(null, null, jsonColumn, mockColumnOption), instanceOf(JsonColumnGetter.class));
|
66
|
+
|
67
|
+
fac = new ColumnGetterFactory(null, null);
|
68
|
+
assertThat(fac.newColumnGetter(null, null, jsonColumn, mockColumnOption), instanceOf(StringColumnGetter.class));
|
69
|
+
}
|
70
|
+
}
|
@@ -3,11 +3,14 @@ package org.embulk.input.mysql;
|
|
3
3
|
import com.google.common.base.Throwables;
|
4
4
|
import com.google.common.collect.ImmutableList;
|
5
5
|
import com.google.common.io.ByteStreams;
|
6
|
+
|
6
7
|
import org.embulk.config.ConfigSource;
|
7
8
|
import org.embulk.test.EmbulkTests;
|
8
9
|
|
9
10
|
import java.io.IOException;
|
10
11
|
|
12
|
+
import jnr.ffi.Platform;
|
13
|
+
import jnr.ffi.Platform.OS;
|
11
14
|
import static java.util.Locale.ENGLISH;
|
12
15
|
|
13
16
|
public class MySQLTests
|
@@ -35,7 +38,7 @@ public class MySQLTests
|
|
35
38
|
.add(config.get(String.class, "port", "3306"))
|
36
39
|
.add(config.get(String.class, "database"))
|
37
40
|
.add("-e")
|
38
|
-
.add(sql);
|
41
|
+
.add(convert(sql));
|
39
42
|
|
40
43
|
ProcessBuilder pb = new ProcessBuilder(args.build());
|
41
44
|
pb.redirectErrorStream(true);
|
@@ -52,4 +55,13 @@ public class MySQLTests
|
|
52
55
|
"Command finished with non-zero exit code. Exit code is %d.", code));
|
53
56
|
}
|
54
57
|
}
|
58
|
+
|
59
|
+
private static String convert(String sql)
|
60
|
+
{
|
61
|
+
if (Platform.getNativePlatform().getOS().equals(OS.WINDOWS)) {
|
62
|
+
// '"' should be '\"' and '\' should be '\\' in Windows
|
63
|
+
return sql.replace("\\\\", "\\").replace("\\", "\\\\").replace("\"", "\\\"");
|
64
|
+
}
|
65
|
+
return sql;
|
66
|
+
}
|
55
67
|
}
|
@@ -0,0 +1,93 @@
|
|
1
|
+
package org.embulk.input.mysql;
|
2
|
+
|
3
|
+
import org.embulk.config.ConfigSource;
|
4
|
+
import org.embulk.input.MySQLInputPlugin;
|
5
|
+
import org.embulk.spi.InputPlugin;
|
6
|
+
import org.embulk.test.EmbulkTests;
|
7
|
+
import org.embulk.test.TestingEmbulk;
|
8
|
+
import org.junit.Before;
|
9
|
+
import org.junit.Rule;
|
10
|
+
import org.junit.Test;
|
11
|
+
|
12
|
+
import java.nio.file.Path;
|
13
|
+
|
14
|
+
import static org.embulk.input.mysql.MySQLTests.execute;
|
15
|
+
import static org.embulk.test.EmbulkTests.readSortedFile;
|
16
|
+
import static org.hamcrest.Matchers.is;
|
17
|
+
import static org.junit.Assert.assertThat;
|
18
|
+
|
19
|
+
public class OptionTest
|
20
|
+
{
|
21
|
+
private static final String BASIC_RESOURCE_PATH = "org/embulk/input/mysql/test/expect/option/";
|
22
|
+
|
23
|
+
private static ConfigSource loadYamlResource(TestingEmbulk embulk, String fileName)
|
24
|
+
{
|
25
|
+
return embulk.loadYamlResource(BASIC_RESOURCE_PATH + fileName);
|
26
|
+
}
|
27
|
+
|
28
|
+
private static String readResource(String fileName)
|
29
|
+
{
|
30
|
+
return EmbulkTests.readResource(BASIC_RESOURCE_PATH + fileName);
|
31
|
+
}
|
32
|
+
|
33
|
+
@Rule
|
34
|
+
public TestingEmbulk embulk = TestingEmbulk.builder()
|
35
|
+
.registerPlugin(InputPlugin.class, "mysql", MySQLInputPlugin.class)
|
36
|
+
.build();
|
37
|
+
|
38
|
+
private ConfigSource baseConfig;
|
39
|
+
|
40
|
+
@Before
|
41
|
+
public void setup()
|
42
|
+
{
|
43
|
+
baseConfig = MySQLTests.baseConfig();
|
44
|
+
execute(readResource("setup.sql")); // setup rows
|
45
|
+
}
|
46
|
+
|
47
|
+
@Test
|
48
|
+
public void testBeforeSetup() throws Exception
|
49
|
+
{
|
50
|
+
Path out1 = embulk.createTempFile("csv");
|
51
|
+
TestingEmbulk.RunResult result1 = embulk.runInput(baseConfig.merge(loadYamlResource(embulk, "before_setup.yml")), out1);
|
52
|
+
assertThat(readSortedFile(out1), is(readResource("before_setup_expected.csv")));
|
53
|
+
}
|
54
|
+
|
55
|
+
@Test
|
56
|
+
public void testBeforeSelect() throws Exception
|
57
|
+
{
|
58
|
+
Path out1 = embulk.createTempFile("csv");
|
59
|
+
TestingEmbulk.RunResult result1 = embulk.runInput(baseConfig.merge(loadYamlResource(embulk, "before_select.yml")), out1);
|
60
|
+
assertThat(readSortedFile(out1), is(readResource("before_select_expected.csv")));
|
61
|
+
}
|
62
|
+
|
63
|
+
@Test
|
64
|
+
public void testAfterSelect() throws Exception
|
65
|
+
{
|
66
|
+
Path out1 = embulk.createTempFile("csv");
|
67
|
+
TestingEmbulk.RunResult result1 = embulk.runInput(baseConfig.merge(loadYamlResource(embulk, "after_select.yml")), out1);
|
68
|
+
assertThat(readSortedFile(out1), is(readResource("expected1.csv")));
|
69
|
+
|
70
|
+
baseConfig = MySQLTests.baseConfig();
|
71
|
+
Path out2 = embulk.createTempFile("csv");
|
72
|
+
TestingEmbulk.RunResult result2 = embulk.runInput(baseConfig.merge(loadYamlResource(embulk, "input.yml")), out2);
|
73
|
+
assertThat(readSortedFile(out2), is(readResource("after_select_expected.csv")));
|
74
|
+
}
|
75
|
+
|
76
|
+
@Test
|
77
|
+
public void testColumnOptions() throws Exception
|
78
|
+
{
|
79
|
+
Path out1 = embulk.createTempFile("csv");
|
80
|
+
TestingEmbulk.RunResult result1 = embulk.runInput(baseConfig.merge(loadYamlResource(embulk, "column_options.yml")), out1);
|
81
|
+
assertThat(readSortedFile(out1), is(readResource("column_options_expected.csv")));
|
82
|
+
}
|
83
|
+
|
84
|
+
@Test
|
85
|
+
public void testDefaultColumnOptions() throws Exception
|
86
|
+
{
|
87
|
+
Path out1 = embulk.createTempFile("csv");
|
88
|
+
TestingEmbulk.RunResult result1 = embulk.runInput(baseConfig.merge(loadYamlResource(embulk, "default_column_options.yml")), out1);
|
89
|
+
assertThat(readSortedFile(out1), is(readResource("default_column_options_expected.csv")));
|
90
|
+
}
|
91
|
+
|
92
|
+
|
93
|
+
}
|
@@ -17,6 +17,7 @@ create table test1 (
|
|
17
17
|
c13 timestamp,
|
18
18
|
c14 time,
|
19
19
|
c15 datetime(6),
|
20
|
+
c16 json,
|
20
21
|
primary key(id)
|
21
22
|
);
|
22
23
|
|
@@ -36,6 +37,7 @@ insert into test1 values(
|
|
36
37
|
null,
|
37
38
|
'2015-06-04 23:45:06',
|
38
39
|
null,
|
40
|
+
null,
|
39
41
|
null
|
40
42
|
);
|
41
43
|
|
@@ -55,7 +57,8 @@ insert into test1 values(
|
|
55
57
|
'2015-06-04 12:34:56',
|
56
58
|
'2015-06-04 23:45:06',
|
57
59
|
'08:04:02',
|
58
|
-
'2015-06-04 01:02:03.123456'
|
60
|
+
'2015-06-04 01:02:03.123456',
|
61
|
+
'{"key":"value"}'
|
59
62
|
);
|
60
63
|
|
61
64
|
drop table if exists test2;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
10,,,,,,,,,,,,,2015-06-04 23:45:06.000000 +0000
|
2
|
-
11,true,true,false,false,true,true,false,true,,,2015-06-03 21:00:00.000000 +0000,2015-06-04 12:34:56.000000 +0000,2015-06-04 23:45:06.000000 +0000,1970-01-01 06:04:02.000000 +0000,2015-06-04 01:02:03.123456 +0000
|
1
|
+
10,,,,,,,,,,,,,2015-06-04 23:45:06.000000 +0000,,,
|
2
|
+
11,true,true,false,false,true,true,false,true,,,2015-06-03 21:00:00.000000 +0000,2015-06-04 12:34:56.000000 +0000,2015-06-04 23:45:06.000000 +0000,1970-01-01 06:04:02.000000 +0000,2015-06-04 01:02:03.123456 +0000,"{""key"":""value""}"
|
@@ -1,2 +1,2 @@
|
|
1
|
-
10,,,,,,,,,,,,,2015-06-04 23:45:06.000000 +0000
|
2
|
-
11,99.0,9999.0,-9.9999999E7,-1.0E16,1.2345000505447388,1.234567890123,-1234.0,1.2345678901234568E17,5678.0,,2015-06-03 21:00:00.000000 +0000,2015-06-04 12:34:56.000000 +0000,2015-06-04 23:45:06.000000 +0000,1970-01-01 06:04:02.000000 +0000,2015-06-04 01:02:03.123456 +0000
|
1
|
+
10,,,,,,,,,,,,,2015-06-04 23:45:06.000000 +0000,,,
|
2
|
+
11,99.0,9999.0,-9.9999999E7,-1.0E16,1.2345000505447388,1.234567890123,-1234.0,1.2345678901234568E17,5678.0,,2015-06-03 21:00:00.000000 +0000,2015-06-04 12:34:56.000000 +0000,2015-06-04 23:45:06.000000 +0000,1970-01-01 06:04:02.000000 +0000,2015-06-04 01:02:03.123456 +0000,"{""key"":""value""}"
|
@@ -1,2 +1,2 @@
|
|
1
|
-
10,,,,,,,,,,,,,2015-06-04 23:45:06.000000 +0000
|
2
|
-
11,99,9999,-99999999,-9999999999999999,1.2345000505447388,1.234567890123,-1234.0,1.2345678901234568E17,5678,xy,2015-06-03 21:00:00.000000 +0000,2015-06-04 12:34:56.000000 +0000,2015-06-04 23:45:06.000000 +0000,1970-01-01 06:04:02.000000 +0000,2015-06-04 01:02:03.123456 +0000
|
1
|
+
10,,,,,,,,,,,,,2015-06-04 23:45:06.000000 +0000,,,
|
2
|
+
11,99,9999,-99999999,-9999999999999999,1.2345000505447388,1.234567890123,-1234.0,1.2345678901234568E17,5678,xy,2015-06-03 21:00:00.000000 +0000,2015-06-04 12:34:56.000000 +0000,2015-06-04 23:45:06.000000 +0000,1970-01-01 06:04:02.000000 +0000,2015-06-04 01:02:03.123456 +0000,"{""key"":""value""}"
|
@@ -1,2 +1,2 @@
|
|
1
|
-
10,,,,,,,,,,,,,2015-06-04 23:45:06.000000 +0000
|
2
|
-
11,99,9999,-99999999,-9999999999999999,1,1,-1234,123456789012345678,5678,,2015-06-03 21:00:00.000000 +0000,2015-06-04 12:34:56.000000 +0000,2015-06-04 23:45:06.000000 +0000,1970-01-01 06:04:02.000000 +0000,2015-06-04 01:02:03.123456 +0000
|
1
|
+
10,,,,,,,,,,,,,2015-06-04 23:45:06.000000 +0000,,,
|
2
|
+
11,99,9999,-99999999,-9999999999999999,1,1,-1234,123456789012345678,5678,,2015-06-03 21:00:00.000000 +0000,2015-06-04 12:34:56.000000 +0000,2015-06-04 23:45:06.000000 +0000,1970-01-01 06:04:02.000000 +0000,2015-06-04 01:02:03.123456 +0000,"{""key"":""value""}"
|
@@ -1,2 +1,2 @@
|
|
1
|
-
10,,,,,,,,,,,,,2015-06-04 23:45:06.000000 +0000
|
2
|
-
11,99,9999,-99999999,-9999999999999999,1.2345,1.234567890123,-1234,123456789012345678.12,5678,xy,2015-06-03 21:00:00.000000 +0000,2015-06-04 12:34:56.000000 +0000,2015-06-04 23:45:06.000000 +0000,1970-01-01 06:04:02.000000 +0000,2015-06-04 01:02:03.123456 +0000
|
1
|
+
10,,,,,,,,,,,,,2015-06-04 23:45:06.000000 +0000,,,
|
2
|
+
11,99,9999,-99999999,-9999999999999999,1.2345,1.234567890123,-1234,123456789012345678.12,5678,xy,2015-06-03 21:00:00.000000 +0000,2015-06-04 12:34:56.000000 +0000,2015-06-04 23:45:06.000000 +0000,1970-01-01 06:04:02.000000 +0000,2015-06-04 01:02:03.123456 +0000,"{""key"":""value""}"
|
data/src/test/resources/org/embulk/input/mysql/test/expect/basic/test_timestamp1_expected.csv
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
10,,,,,,,,,,,,,2015-06-04 23:45:06.000000 +0000
|
2
|
-
11,99,9999,-99999999,-9999999999999999,1.2345000505447388,1.234567890123,-1234.0,1.2345678901234568E17,5678,xy,2015-06-03 21:00:00.000000 +0000,2015-06-04 12:34:56.000000 +0000,2015-06-04 23:45:06.000000 +0000,1970-01-01 06:04:02.000000 +0000,2015-06-04 01:02:03.123456 +0000
|
1
|
+
10,,,,,,,,,,,,,2015-06-04 23:45:06.000000 +0000,,,
|
2
|
+
11,99,9999,-99999999,-9999999999999999,1.2345000505447388,1.234567890123,-1234.0,1.2345678901234568E17,5678,xy,2015-06-03 21:00:00.000000 +0000,2015-06-04 12:34:56.000000 +0000,2015-06-04 23:45:06.000000 +0000,1970-01-01 06:04:02.000000 +0000,2015-06-04 01:02:03.123456 +0000,"{""key"":""value""}"
|
data/src/test/resources/org/embulk/input/mysql/test/expect/basic/test_timestamp2_expected.csv
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
10,,,,,,,,,,,,,2015/06/05 08:45:06
|
2
|
-
11,99,9999,-99999999,-9999999999999999,1.2345000505447388,1.234567890123,-1234.0,1.2345678901234568E17,5678,xy,2015/06/03,2015/06/04 12:34:56,2015/06/05 08:45:06,15-04-02,2015/06/04 01:02:03.123456
|
1
|
+
10,,,,,,,,,,,,,2015/06/05 08:45:06,,,
|
2
|
+
11,99,9999,-99999999,-9999999999999999,1.2345000505447388,1.234567890123,-1234.0,1.2345678901234568E17,5678,xy,2015/06/03,2015/06/04 12:34:56,2015/06/05 08:45:06,15-04-02,2015/06/04 01:02:03.123456,"{""key"":""value""}"
|
data/src/test/resources/org/embulk/input/mysql/test/expect/basic/test_timestamp3_expected.csv
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
10,,,,,,,,,,,,,2015/06/05 08:45:06
|
2
|
-
11,99,9999,-99999999,-9999999999999999,1.2345000505447388,1.234567890123,-1234.0,1.2345678901234568E17,5678,xy,2015/06/04,2015/06/04 21:34:56,2015/06/05 08:45:06,09-04-02,2015/06/04 10:02:03.123456
|
1
|
+
10,,,,,,,,,,,,,2015/06/05 08:45:06,,,
|
2
|
+
11,99,9999,-99999999,-9999999999999999,1.2345000505447388,1.234567890123,-1234.0,1.2345678901234568E17,5678,xy,2015/06/04,2015/06/04 21:34:56,2015/06/05 08:45:06,09-04-02,2015/06/04 10:02:03.123456,"{""key"":""value""}"
|
data/src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_decimal_expected.csv
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
10,,,,,,,,,,,,,2015-06-04 23:45:06.000000 +0000
|
2
|
-
11,99.0,9999,-99999999,-9999999999999999,1.2345000505447388,1.234567890123,-1234.0,1.2345678901234568E17,5678,xy,2015-06-03 21:00:00.000000 +0000,2015-06-04 12:34:56.000000 +0000,2015-06-04 23:45:06.000000 +0000,1970-01-01 06:04:02.000000 +0000,2015-06-04 01:02:03.123456 +0000
|
1
|
+
10,,,,,,,,,,,,,2015-06-04 23:45:06.000000 +0000,,,
|
2
|
+
11,99.0,9999,-99999999,-9999999999999999,1.2345000505447388,1.234567890123,-1234.0,1.2345678901234568E17,5678,xy,2015-06-03 21:00:00.000000 +0000,2015-06-04 12:34:56.000000 +0000,2015-06-04 23:45:06.000000 +0000,1970-01-01 06:04:02.000000 +0000,2015-06-04 01:02:03.123456 +0000,"{""key"":""value""}"
|
data/src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_json_expected.csv
ADDED
@@ -0,0 +1,2 @@
|
|
1
|
+
10,,,,,,,,,,,,,2015-06-04 23:45:06.000000 +0000,,,
|
2
|
+
11,99,9999,-99999999,-9999999999999999,1.2345000505447388,1.234567890123,-1234.0,1.2345678901234568E17,5678,,2015-06-03 21:00:00.000000 +0000,2015-06-04 12:34:56.000000 +0000,2015-06-04 23:45:06.000000 +0000,1970-01-01 06:04:02.000000 +0000,2015-06-04 01:02:03.123456 +0000,"{""key"":""value""}"
|
data/src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_string_expected.csv
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
10,,,,,,,,,,,,,2015-06-04 23:45:06.000000 +0000
|
2
|
-
11,99,9999,-99999999,-9999999999999999,1.2345000505447388,1.234567890123,-1234.0,1.2345678901234568E17,5678,xy,2015-06-03 21:00:00.000000 +0000,2015-06-04 12:34:56.000000 +0000,2015-06-04 23:45:06.000000 +0000,1970-01-01 06:04:02.000000 +0000,2015-06-04 01:02:03.123456 +0000
|
1
|
+
10,,,,,,,,,,,,,2015-06-04 23:45:06.000000 +0000,,,
|
2
|
+
11,99,9999,-99999999,-9999999999999999,1.2345000505447388,1.234567890123,-1234.0,1.2345678901234568E17,5678,xy,2015-06-03 21:00:00.000000 +0000,2015-06-04 12:34:56.000000 +0000,2015-06-04 23:45:06.000000 +0000,1970-01-01 06:04:02.000000 +0000,2015-06-04 01:02:03.123456 +0000,"{""key"":""value""}"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
drop table if exists test1;
|
2
|
+
|
3
|
+
create table test1 (
|
4
|
+
id int not null,
|
5
|
+
name varchar(8) not null,
|
6
|
+
primary key(id)
|
7
|
+
);
|
8
|
+
|
9
|
+
insert into test1 values
|
10
|
+
(1, 'A'),
|
11
|
+
(2, 'B'),
|
12
|
+
(3, 'C'),
|
13
|
+
(4, 'D');
|
14
|
+
|
15
|
+
drop table if exists test2;
|
16
|
+
|
17
|
+
drop table if exists test3;
|
18
|
+
|
19
|
+
create table test3 (
|
20
|
+
id int not null,
|
21
|
+
datetime1 datetime,
|
22
|
+
datetime2 datetime,
|
23
|
+
primary key(id)
|
24
|
+
);
|
25
|
+
|
26
|
+
insert into test3 values
|
27
|
+
(1, NULL, NULL),
|
28
|
+
(2, '2019-01-02 12:34:56', '2019-01-02 12:34:56'),
|
29
|
+
(3, '2018-12-31 23:59:59', '2018-12-31 23:59:59');
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-input-mysql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Selects records from a table.
|
14
14
|
email:
|
@@ -19,8 +19,8 @@ extra_rdoc_files: []
|
|
19
19
|
files:
|
20
20
|
- README.md
|
21
21
|
- build.gradle
|
22
|
-
- classpath/embulk-input-jdbc-0.
|
23
|
-
- classpath/embulk-input-mysql-0.
|
22
|
+
- classpath/embulk-input-jdbc-0.10.0.jar
|
23
|
+
- classpath/embulk-input-mysql-0.10.0.jar
|
24
24
|
- default_jdbc_driver/mysql-connector-java-5.1.44.jar
|
25
25
|
- lib/embulk/input/mysql.rb
|
26
26
|
- src/main/java/org/embulk/input/MySQLInputPlugin.java
|
@@ -31,7 +31,9 @@ files:
|
|
31
31
|
- src/main/java/org/embulk/input/mysql/getter/MySQLTimestampTimestampIncrementalHandler.java
|
32
32
|
- src/test/java/org/embulk/input/mysql/BasicTest.java
|
33
33
|
- src/test/java/org/embulk/input/mysql/IncrementalTest.java
|
34
|
+
- src/test/java/org/embulk/input/mysql/MySQLColumnGetterFactoryTest.java
|
34
35
|
- src/test/java/org/embulk/input/mysql/MySQLTests.java
|
36
|
+
- src/test/java/org/embulk/input/mysql/OptionTest.java
|
35
37
|
- src/test/resources/org/embulk/input/mysql/test/expect/basic/setup.sql
|
36
38
|
- src/test/resources/org/embulk/input/mysql/test/expect/basic/test_boolean_config.yml
|
37
39
|
- src/test/resources/org/embulk/input/mysql/test/expect/basic/test_boolean_expected.csv
|
@@ -60,6 +62,9 @@ files:
|
|
60
62
|
- src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_decimal_config.yml
|
61
63
|
- src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_decimal_expected.csv
|
62
64
|
- src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_decimal_expected.diff
|
65
|
+
- src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_json_config.yml
|
66
|
+
- src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_json_expected.csv
|
67
|
+
- src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_json_expected.diff
|
63
68
|
- src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_string_config.yml
|
64
69
|
- src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_string_expected.csv
|
65
70
|
- src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_string_expected.diff
|
@@ -101,6 +106,19 @@ files:
|
|
101
106
|
- src/test/resources/org/embulk/input/mysql/test/expect/incremental/ts/expected_2.diff
|
102
107
|
- src/test/resources/org/embulk/input/mysql/test/expect/incremental/ts/insert_more.sql
|
103
108
|
- src/test/resources/org/embulk/input/mysql/test/expect/incremental/ts/setup.sql
|
109
|
+
- src/test/resources/org/embulk/input/mysql/test/expect/option/after_select.yml
|
110
|
+
- src/test/resources/org/embulk/input/mysql/test/expect/option/after_select_expected.csv
|
111
|
+
- src/test/resources/org/embulk/input/mysql/test/expect/option/before_select.yml
|
112
|
+
- src/test/resources/org/embulk/input/mysql/test/expect/option/before_select_expected.csv
|
113
|
+
- src/test/resources/org/embulk/input/mysql/test/expect/option/before_setup.yml
|
114
|
+
- src/test/resources/org/embulk/input/mysql/test/expect/option/before_setup_expected.csv
|
115
|
+
- src/test/resources/org/embulk/input/mysql/test/expect/option/column_options.yml
|
116
|
+
- src/test/resources/org/embulk/input/mysql/test/expect/option/column_options_expected.csv
|
117
|
+
- src/test/resources/org/embulk/input/mysql/test/expect/option/default_column_options.yml
|
118
|
+
- src/test/resources/org/embulk/input/mysql/test/expect/option/default_column_options_expected.csv
|
119
|
+
- src/test/resources/org/embulk/input/mysql/test/expect/option/expected1.csv
|
120
|
+
- src/test/resources/org/embulk/input/mysql/test/expect/option/input.yml
|
121
|
+
- src/test/resources/org/embulk/input/mysql/test/expect/option/setup.sql
|
104
122
|
homepage: https://github.com/embulk/embulk-input-jdbc
|
105
123
|
licenses:
|
106
124
|
- Apache 2.0
|
@@ -121,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
139
|
version: '0'
|
122
140
|
requirements: []
|
123
141
|
rubyforge_project:
|
124
|
-
rubygems_version: 2.
|
142
|
+
rubygems_version: 2.6.13
|
125
143
|
signing_key:
|
126
144
|
specification_version: 4
|
127
145
|
summary: JDBC input plugin for Embulk
|
Binary file
|
Binary file
|