embulk-input-mysql 0.8.5 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba43696df83d63a83d601310565acb3ee822c46a
4
- data.tar.gz: 73294973cfef407dd7fedbe748d662d911763933
3
+ metadata.gz: 82ffc53340f2ef0742c4aa00830de1b59f22dd99
4
+ data.tar.gz: f33c36841481d1dc53d1aa4691492cbb0d21b147
5
5
  SHA512:
6
- metadata.gz: a0d7cec83ab2439308895c4803f0d92c0fea0cafff0376050f556dd7104804a20122d828033e12dd08a8da812badb683cd2ab3de033694154bfabac42e9bcc0d
7
- data.tar.gz: 7880efc726e147fe90d3f5dba3d235d3c9a6312aa3984a4d54e3e28fb8d94b8ee4878488f5c2d69fdc7d0ca709e19a37d134ae66a5c7e468279e9bc5899eabd0
6
+ metadata.gz: f293f9ac8219eef1ec152ce8637357132a3be1dd1708a777b2d8331936af8d2d4381ac8fe763a780fcf7a818070d96537f3eee191e7ebe30d1cbd199f857c7de
7
+ data.tar.gz: c404695b1c2d45d810ff892848ea679c039e8009f0c73d2c26f68127d3666c93114f70f4baecf7edb5797409f9270e450bf1be2afda400fab490b48c39e510f2
data/README.md CHANGED
@@ -72,7 +72,7 @@ At the next execution, when `last_record: ` is also set, this plugin generates a
72
72
  SELECT * FROM (
73
73
  ...original query is here...
74
74
  )
75
- WHERE created_at > '2017-01-01 00:32:12' OR (created_at = '2017-01-01 00:32:12' AND id > 5291)
75
+ WHERE updated_at > '2017-01-01 00:32:12' OR (updated_at = '2017-01-01 00:32:12' AND id > 5291)
76
76
  ORDER BY updated_at, id
77
77
  ```
78
78
 
@@ -1,14 +1,15 @@
1
1
  package org.embulk.input.mysql.getter;
2
2
 
3
3
  import com.fasterxml.jackson.databind.JsonNode;
4
+ import com.google.common.base.Optional;
5
+ import org.embulk.config.ConfigSource;
6
+ import org.embulk.config.Task;
4
7
  import org.embulk.input.jdbc.getter.AbstractIncrementalHandler;
5
8
  import org.embulk.input.jdbc.getter.ColumnGetter;
6
9
  import org.embulk.spi.Column;
7
10
  import org.embulk.spi.Exec;
8
11
  import org.embulk.spi.time.TimestampFormatter;
9
- import org.embulk.spi.time.TimestampFormatter.FormatterTask;
10
12
  import org.embulk.spi.time.TimestampParser;
11
- import org.embulk.spi.time.TimestampParser.ParserTask;
12
13
  import org.joda.time.DateTimeZone;
13
14
 
14
15
  import java.sql.PreparedStatement;
@@ -42,13 +43,20 @@ public abstract class AbstractMySQLTimestampIncrementalHandler
42
43
  super.getAndSet(from, fromIndex, toColumn);
43
44
  }
44
45
 
46
+ private static interface FormatterIntlTask extends Task, TimestampFormatter.Task {}
47
+ private static interface FormatterIntlColumnOption extends Task, TimestampFormatter.TimestampColumnOption {}
48
+
45
49
  @Override
46
50
  public JsonNode encodeToJson()
47
51
  {
48
- FormatterTask task = Exec.newConfigSource()
49
- .set("timezone", "UTC")
50
- .loadConfig(FormatterTask.class);
51
- TimestampFormatter formatter = new TimestampFormatter(getTimestampFormat(), task);
52
+ // TODO: Switch to a newer TimestampFormatter constructor after a reasonable interval.
53
+ // Traditional constructor is used here for compatibility.
54
+ final ConfigSource configSource = Exec.newConfigSource();
55
+ configSource.set("format", getTimestampFormat());
56
+ configSource.set("timezone", "UTC");
57
+ TimestampFormatter formatter = new TimestampFormatter(
58
+ Exec.newConfigSource().loadConfig(FormatterIntlTask.class),
59
+ Optional.fromNullable(configSource.loadConfig(FormatterIntlColumnOption.class)));
52
60
  String text = formatter.format(utcTimestampFromSessionTime(epochSecond, nano));
53
61
  return jsonNodeFactory.textNode(text);
54
62
  }
@@ -57,14 +65,21 @@ public abstract class AbstractMySQLTimestampIncrementalHandler
57
65
 
58
66
  protected abstract org.embulk.spi.time.Timestamp utcTimestampFromSessionTime(long epochSecond, int nano);
59
67
 
68
+ private static interface ParserIntlTask extends Task, TimestampParser.Task {}
69
+ private static interface ParserIntlColumnOption extends Task, TimestampParser.TimestampColumnOption {}
70
+
60
71
  @Override
61
72
  public void decodeFromJsonTo(PreparedStatement toStatement, int toIndex, JsonNode fromValue)
62
73
  throws SQLException
63
74
  {
64
- ParserTask task = Exec.newConfigSource()
65
- .set("default_timezone", "UTC")
66
- .loadConfig(ParserTask.class);
67
- TimestampParser parser = new TimestampParser(getTimestampPattern(), task);
75
+ // TODO: Switch to a newer TimestampParser constructor after a reasonable interval.
76
+ // Traditional constructor is used here for compatibility.
77
+ final ConfigSource configSource = Exec.newConfigSource();
78
+ configSource.set("format", getTimestampPattern());
79
+ configSource.set("timezone", "UTC");
80
+ TimestampParser parser = new TimestampParser(
81
+ Exec.newConfigSource().loadConfig(ParserIntlTask.class),
82
+ configSource.loadConfig(ParserIntlColumnOption.class));
68
83
  org.embulk.spi.time.Timestamp epoch = parser.parse(fromValue.asText());
69
84
  toStatement.setTimestamp(toIndex, utcTimestampToSessionTime(epoch));
70
85
  }
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.8.5
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-31 00:00:00.000000000 Z
11
+ date: 2017-11-24 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.8.5.jar
23
- - classpath/embulk-input-mysql-0.8.5.jar
22
+ - classpath/embulk-input-jdbc-0.8.6.jar
23
+ - classpath/embulk-input-mysql-0.8.6.jar
24
24
  - default_jdbc_driver/mysql-connector-java-5.1.34.jar
25
25
  - lib/embulk/input/mysql.rb
26
26
  - src/main/java/org/embulk/input/MySQLInputPlugin.java