embulk-input-mysql 0.10.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc441427089a73c25d30442c2683f881bebcb3d6297d3ef062ebb3a069912a49
4
- data.tar.gz: c9dba75abd31ef6fff03aa0e7a5fb3938e8df75ef3202ddfedebf106419e4902
3
+ metadata.gz: 660ed6d7a5a4be33a8c313f62b415b2d04c8af90b10f6ccc9309c768247b720c
4
+ data.tar.gz: 9ba6cd527699dd7357118764e47000b95638d2cae7fcf822b8e25bfc4b0ffb51
5
5
  SHA512:
6
- metadata.gz: 7105db953dedce4d4b84bffcdb9219cdc52dd889592a6907a3b3c2b5ca52d821ec29029d2f9765bbce29779f1fd0df193adc2c86029eb08dcde84065db697fe9
7
- data.tar.gz: 75a2c458dfb3b43d0d0321b145c5d8db6789d9a3408110d3a807e358f9f15d40e032cb5f9e6e20258f0ac0f8b51be8921739770c098805a2d441e8cb2ca19948
6
+ metadata.gz: 3ff886c1e4eb01827a23d12b487d4e6b4c1f1f38594e64d9e4c83d080778501210b201fb98265215179a0d66d29b44d0b8e1c9b683d27d2ac38e767fe039c8f2
7
+ data.tar.gz: 6714232e99e617371e789f3a2171e96017e35ba9d70b4acfdb4aa976d34759cef033bf6f96805541a8acf19c4d816d63749fb119133c073721f4a986e97e9b3c
data/README.md CHANGED
@@ -41,7 +41,7 @@ MySQL input plugin for Embulk loads records from MySQL.
41
41
  - **socket_timeout**: timeout on network socket operations. 0 means no timeout. (integer (seconds), default: 1800)
42
42
  - **options**: extra JDBC properties (hash, default: {})
43
43
  - **incremental**: if true, enables incremental loading. See next section for details (boolean, default: false)
44
- - **incremental_columns**: column names for incremental loading (array of strings, default: use primary keys)
44
+ - **incremental_columns**: column names for incremental loading (array of strings, default: use primary keys). Columns of integer types, string types, `datetime` and `timestamp` are supported.
45
45
  - **last_record**: values of the last record for incremental loading (array of objects, default: load all records)
46
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`)
47
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.
@@ -75,13 +75,13 @@ ORDER BY updated_at, id
75
75
 
76
76
  When bulk data loading finishes successfully, it outputs `last_record: ` paramater as config-diff so that next execution uses it.
77
77
 
78
- At the next execution, when `last_record: ` is also set, this plugin generates additional WHERE conditions to load records larger than the last record. For example, if `last_record: ["2017-01-01 00:32:12", 5291]` is set,
78
+ At the next execution, when `last_record: ` is also set, this plugin generates additional WHERE conditions to load records larger than the last record. For example, if `last_record: ["2017-01-01T00:32:12.487659", 5291]` is set,
79
79
 
80
80
  ```
81
81
  SELECT * FROM (
82
82
  ...original query is here...
83
83
  )
84
- WHERE updated_at > '2017-01-01 00:32:12' OR (updated_at = '2017-01-01 00:32:12' AND id > 5291)
84
+ WHERE updated_at > '2017-01-01 00:32:12.487659' OR (updated_at = '2017-01-01 00:32:12.487659' AND id > 5291)
85
85
  ORDER BY updated_at, id
86
86
  ```
87
87
 
@@ -65,6 +65,26 @@ public class IncrementalTest
65
65
  assertThat(result2.getConfigDiff(), is((ConfigDiff) loadYamlResource(embulk, "int/expected_2.diff")));
66
66
  }
67
67
 
68
+ @Test
69
+ public void testChar() throws Exception
70
+ {
71
+ // setup first rows
72
+ execute(readResource("char/setup.sql"));
73
+
74
+ Path out1 = embulk.createTempFile("csv");
75
+ RunResult result1 = embulk.runInput(baseConfig.merge(loadYamlResource(embulk, "char/config_1.yml")), out1);
76
+ assertThat(readSortedFile(out1), is(readResource("char/expected_1.csv")));
77
+ assertThat(result1.getConfigDiff(), is((ConfigDiff) loadYamlResource(embulk, "char/expected_1.diff")));
78
+
79
+ // insert more rows
80
+ execute(readResource("char/insert_more.sql"));
81
+
82
+ Path out2 = embulk.createTempFile("csv");
83
+ RunResult result2 = embulk.runInput(baseConfig.merge(loadYamlResource(embulk, "char/config_2.yml")), out2);
84
+ assertThat(readSortedFile(out2), is(readResource("char/expected_2.csv")));
85
+ assertThat(result2.getConfigDiff(), is((ConfigDiff) loadYamlResource(embulk, "char/expected_2.diff")));
86
+ }
87
+
68
88
  @Test
69
89
  public void testDateTime() throws Exception
70
90
  {
@@ -0,0 +1,3 @@
1
+ table: char_load
2
+ incremental: true
3
+ incremental_columns: [name]
@@ -0,0 +1,4 @@
1
+ table: char_load
2
+ last_record: ['A4']
3
+ incremental: true
4
+ incremental_columns: [name]
@@ -0,0 +1,7 @@
1
+
2
+ insert into char_load (name, note) values
3
+ ('A0', 'more_skip'),
4
+ ('A4', 'more_skip'),
5
+ ('A9', 'more_load'),
6
+ ('A5', 'more_load');
7
+
@@ -0,0 +1,13 @@
1
+ drop table if exists char_load;
2
+
3
+ create table char_load (
4
+ name char(2) not null,
5
+ note text
6
+ );
7
+
8
+ insert into char_load (name, note) values
9
+ ('A3', 'first'),
10
+ ('A4', 'first'),
11
+ ('A2', 'first'),
12
+ ('A1', 'first');
13
+
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.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-23 00:00:00.000000000 Z
11
+ date: 2019-09-06 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.10.0.jar
23
- - classpath/embulk-input-mysql-0.10.0.jar
22
+ - classpath/embulk-input-jdbc-0.10.1.jar
23
+ - classpath/embulk-input-mysql-0.10.1.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
@@ -68,6 +68,14 @@ files:
68
68
  - src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_string_config.yml
69
69
  - src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_string_expected.csv
70
70
  - src/test/resources/org/embulk/input/mysql/test/expect/basic/test_valuetype_string_expected.diff
71
+ - src/test/resources/org/embulk/input/mysql/test/expect/incremental/char/config_1.yml
72
+ - src/test/resources/org/embulk/input/mysql/test/expect/incremental/char/config_2.yml
73
+ - src/test/resources/org/embulk/input/mysql/test/expect/incremental/char/expected_1.csv
74
+ - src/test/resources/org/embulk/input/mysql/test/expect/incremental/char/expected_1.diff
75
+ - src/test/resources/org/embulk/input/mysql/test/expect/incremental/char/expected_2.csv
76
+ - src/test/resources/org/embulk/input/mysql/test/expect/incremental/char/expected_2.diff
77
+ - src/test/resources/org/embulk/input/mysql/test/expect/incremental/char/insert_more.sql
78
+ - src/test/resources/org/embulk/input/mysql/test/expect/incremental/char/setup.sql
71
79
  - src/test/resources/org/embulk/input/mysql/test/expect/incremental/dt/config_1.yml
72
80
  - src/test/resources/org/embulk/input/mysql/test/expect/incremental/dt/config_2.yml
73
81
  - src/test/resources/org/embulk/input/mysql/test/expect/incremental/dt/expected_1.csv