embulk-input-jdbc 0.1.0 → 0.2.0

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: 266e103762b852c24503fb2a83616a78bd07a235
4
- data.tar.gz: 01314fad5353c44cdf63c3cf59c5ae1f029c7c2f
3
+ metadata.gz: 04a66446f33cb93478fac400edddfde76fc16a3b
4
+ data.tar.gz: b8bcffe863fa757da3124c6a6d9b82b317d0662f
5
5
  SHA512:
6
- metadata.gz: 3004de01d140d8920f8be786fc2e58f14bf3b9ddff09f1a9e59b5ebe4c8f4a5db582af57431193e9427b664de3c9fe660d78cea1de2fea66c8579ddd0c882c59
7
- data.tar.gz: 30b3caa6cc8ac3a25f520d2386bb3134be88678d3a3287197fae630acaee6163e8ab84618e4d56341bd03428537122bec231b58d4c019e46022da1e20e2851be
6
+ metadata.gz: f20fedd3f5d22ac57067b83e4dbd6038c5f69acca74a810af84934e1a988dd5acc3ae16afe960324f929a37e2c7bbbd8e6194de4f1195632446001a5915d78ee
7
+ data.tar.gz: 4176be4dafda7373475ccd04e198ed27c809b1853590617ac10f3da1c058082ea61169bff33791f0f431ccdfb8ee46b564ebe96c312a22382877354ece647e04
@@ -4,6 +4,7 @@ import java.util.List;
4
4
  import java.util.Properties;
5
5
  import java.sql.ResultSet;
6
6
  import java.sql.SQLException;
7
+ import org.slf4j.Logger;
7
8
  import com.google.common.base.Optional;
8
9
  import com.google.common.base.Throwables;
9
10
  import com.google.common.collect.ImmutableList;
@@ -29,6 +30,8 @@ import org.embulk.input.jdbc.JdbcInputConnection.BatchSelect;
29
30
  public abstract class AbstractJdbcInputPlugin
30
31
  implements InputPlugin
31
32
  {
33
+ private final Logger logger = Exec.getLogger(getClass());
34
+
32
35
  public interface PluginTask extends Task
33
36
  {
34
37
  @Config("host")
@@ -145,7 +148,6 @@ public abstract class AbstractJdbcInputPlugin
145
148
  } catch (SQLException ex) {
146
149
  throw Throwables.propagate(ex);
147
150
  }
148
- System.out.println("schema: "+schema);
149
151
 
150
152
  return buildNextConfigDiff(task, control.run(task.dump(), schema, 1));
151
153
  }
@@ -221,7 +223,6 @@ public abstract class AbstractJdbcInputPlugin
221
223
  while (true) {
222
224
  // TODO run fetch() in another thread asynchronously
223
225
  // TODO retry fetch() if it failed (maybe order_by is required and unique_column(s) option is also required)
224
- System.out.println("fetch....");
225
226
  boolean cont = fetch(cursor, getters, pageBuilder);
226
227
  if (!cont) {
227
228
  break;
@@ -261,17 +262,20 @@ public abstract class AbstractJdbcInputPlugin
261
262
  return false;
262
263
  }
263
264
 
264
- System.out.println("res: "+result);
265
-
266
265
  List<Column> columns = pageBuilder.getSchema().getColumns();
266
+ long rows = 0;
267
+ long reportRows = 500;
267
268
  do {
268
- System.out.println("record.");
269
269
  for (int i=0; i < getters.size(); i++) {
270
270
  int index = i + 1; // JDBC column index begins from 1
271
- System.out.println("getters "+i+" "+getters.get(i));
272
271
  getters.get(i).getAndSet(result, index, pageBuilder, columns.get(i));
273
272
  }
274
273
  pageBuilder.addRecord();
274
+ rows++;
275
+ if (rows % reportRows == 0) {
276
+ logger.info(String.format("Fetched %,d rows.", rows));
277
+ reportRows *= 2;
278
+ }
275
279
  } while (result.next());
276
280
  return true;
277
281
  }
@@ -86,14 +86,11 @@ public class ColumnGetters
86
86
  public void getAndSet(ResultSet from, int fromIndex,
87
87
  PageBuilder to, Column toColumn) throws SQLException
88
88
  {
89
- System.out.println("string column from "+fromIndex+" to "+toColumn);
90
89
  String v = from.getString(fromIndex);
91
90
  if (from.wasNull()) {
92
91
  to.setNull(toColumn);
93
- System.out.println("> was null");
94
92
  } else {
95
93
  to.setString(toColumn, v);
96
- System.out.println("> "+v);
97
94
  }
98
95
  }
99
96
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-jdbc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - FURUHASHI Sadayuki
@@ -26,7 +26,7 @@ files:
26
26
  - src/main/java/org/embulk/input/jdbc/getter/ColumnGetter.java
27
27
  - src/main/java/org/embulk/input/jdbc/getter/ColumnGetterFactory.java
28
28
  - src/main/java/org/embulk/input/jdbc/getter/ColumnGetters.java
29
- - classpath/embulk-input-jdbc-0.1.0.jar
29
+ - classpath/embulk-input-jdbc-0.2.0.jar
30
30
  homepage: https://github.com/embulk/embulk-input-jdbc
31
31
  licenses:
32
32
  - Apache 2.0