embulk-output-embulk_output_domo 0.2.0 → 0.2.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fb7cddec754cbf91746ecdf64cb1f1e60a83629
|
4
|
+
data.tar.gz: de3b04d810197478663fc110bff6b271738de0d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c172cf5cc559b1a1824f339b385a11a50300678f5d196879b2f22a58c8e1c3d835d01e8cdcdf83190c594f4096e9faa4b3bcee3a45267eb743e997d48b668849
|
7
|
+
data.tar.gz: 42dc9b0078667bf455be49bf3210befd62132e65e94a19a779e42a558894e2d19d848963e2f0150af07cb47cf4c8b2fb2d3b4e33fadc31de288e72871d52b427
|
data/README.md
CHANGED
@@ -1,14 +1,20 @@
|
|
1
1
|
# Embulk Output Domo output plugin for Embulk
|
2
|
-
|
3
|
-
|
2
|
+
This embulk output plugin sends data to a Domo Dataset using domo Stream API.
|
3
|
+
Using the [domo jdk](https://github.com/domoinc/domo-java-sdk) we can move data from embulk input to domo Stream API.
|
4
4
|
|
5
5
|
## Overview
|
6
6
|
|
7
7
|
* **Plugin type**: output
|
8
|
-
* **Load all or nothing**:
|
8
|
+
* **Load all or nothing**: yes
|
9
9
|
* **Resume supported**: no
|
10
10
|
* **Cleanup supported**: yes
|
11
11
|
|
12
|
+
|
13
|
+
## Install
|
14
|
+
```
|
15
|
+
embulk gem install embulk-output-embulk_output_domo
|
16
|
+
```
|
17
|
+
|
12
18
|
## Configuration
|
13
19
|
|
14
20
|
- **clientId**: description (string, required)
|
@@ -29,12 +35,11 @@ TODO: Write short description here and build.gradle file.
|
|
29
35
|
```yaml
|
30
36
|
out:
|
31
37
|
type: embulk_output_domo
|
32
|
-
clientId: 209410f4
|
33
|
-
clientSecret:
|
38
|
+
clientId: 209410f4
|
39
|
+
clientSecret: 00
|
34
40
|
apiHost: api.domo.com
|
35
41
|
useHttps: true
|
36
|
-
streamName: Daily Metrics Test
|
37
|
-
updateMethod: APPEND
|
42
|
+
streamName: Daily Metrics Test
|
38
43
|
batchSize: 500
|
39
44
|
```
|
40
45
|
|
data/build.gradle
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
+
#Thu Oct 18 13:21:42 EEST 2018
|
1
2
|
distributionBase=GRADLE_USER_HOME
|
2
3
|
distributionPath=wrapper/dists
|
3
4
|
zipStoreBase=GRADLE_USER_HOME
|
4
5
|
zipStorePath=wrapper/dists
|
5
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-
|
6
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
|
@@ -66,6 +66,7 @@ public class EmbulkOutputDomoOutputPlugin
|
|
66
66
|
private static ArrayList<String> recordsParts = new ArrayList<String>();
|
67
67
|
private int currentPartCounter = 1;
|
68
68
|
private static int totalBatches = 1;
|
69
|
+
private static int pageReaderCount = 0;
|
69
70
|
|
70
71
|
public enum QuotePolicy
|
71
72
|
{
|
@@ -86,7 +87,6 @@ public class EmbulkOutputDomoOutputPlugin
|
|
86
87
|
}
|
87
88
|
}
|
88
89
|
|
89
|
-
|
90
90
|
public interface TimestampColumnOption
|
91
91
|
extends Task, TimestampFormatter.TimestampColumnOption
|
92
92
|
{
|
@@ -184,7 +184,6 @@ public class EmbulkOutputDomoOutputPlugin
|
|
184
184
|
}
|
185
185
|
}
|
186
186
|
|
187
|
-
|
188
187
|
@Override
|
189
188
|
public ConfigDiff transaction(ConfigSource config,
|
190
189
|
Schema schema, int taskCount,
|
@@ -262,55 +261,6 @@ public class EmbulkOutputDomoOutputPlugin
|
|
262
261
|
logger.info("Committed Execution: " + committedExecution);
|
263
262
|
}
|
264
263
|
|
265
|
-
private String stringifyList(List<StringBuilder> records){
|
266
|
-
StringBuilder sb = new StringBuilder();
|
267
|
-
for (StringBuilder s : records)
|
268
|
-
{
|
269
|
-
if(s!=null) {
|
270
|
-
sb.append(s);
|
271
|
-
sb.append("\n");
|
272
|
-
}
|
273
|
-
else{
|
274
|
-
logger.info("NULL Found!");
|
275
|
-
}
|
276
|
-
}
|
277
|
-
return sb.toString();
|
278
|
-
}
|
279
|
-
|
280
|
-
private String stringify(ArrayList<StringBuilder> records) {
|
281
|
-
StringBuilder sb = new StringBuilder();
|
282
|
-
for (StringBuilder s : records)
|
283
|
-
{
|
284
|
-
sb.append(s);
|
285
|
-
sb.append("\n");
|
286
|
-
}
|
287
|
-
return sb.toString();
|
288
|
-
}
|
289
|
-
|
290
|
-
|
291
|
-
public static <T> List<List<T>> batches(List<T> input, int chunkSize) {
|
292
|
-
|
293
|
-
int inputSize = input.size();
|
294
|
-
int chunkCount = (int) Math.ceil(inputSize / (double) chunkSize);
|
295
|
-
logger.info("chunkCount = "+chunkCount);
|
296
|
-
|
297
|
-
Map<Integer, List<T>> map = new HashMap<>(chunkCount);
|
298
|
-
List<List<T>> chunks = new ArrayList<>(chunkCount);
|
299
|
-
|
300
|
-
for (int i = 0; i < inputSize; i++) {
|
301
|
-
|
302
|
-
map.computeIfAbsent(i / chunkSize, (ignore) -> {
|
303
|
-
|
304
|
-
List<T> chunk = new ArrayList<>();
|
305
|
-
chunks.add(chunk);
|
306
|
-
return chunk;
|
307
|
-
|
308
|
-
}).add(input.get(i));
|
309
|
-
}
|
310
|
-
|
311
|
-
return chunks;
|
312
|
-
}
|
313
|
-
|
314
264
|
@Override
|
315
265
|
public TransactionalPageOutput open(TaskSource taskSource, Schema schema, int taskIndex)
|
316
266
|
{
|
@@ -329,7 +279,7 @@ public class EmbulkOutputDomoOutputPlugin
|
|
329
279
|
private PluginTask task;
|
330
280
|
|
331
281
|
private Schema schema;
|
332
|
-
|
282
|
+
ArrayList<StringBuilder> recordsPage = new ArrayList<StringBuilder>();
|
333
283
|
|
334
284
|
public DomoPageOutput(final PageReader pageReader,
|
335
285
|
DomoClient client, PluginTask task, Schema schema)
|
@@ -346,7 +296,9 @@ public class EmbulkOutputDomoOutputPlugin
|
|
346
296
|
{
|
347
297
|
try {
|
348
298
|
pageReader.setPage(page);
|
349
|
-
|
299
|
+
pageReaderCount+=pageReader.getRecordCount(page);
|
300
|
+
logger.info("Page Reader Count = "+pageReader.getRecordCount(page) +" and page reader total count = " + pageReaderCount);
|
301
|
+
|
350
302
|
final char delimiter = ',';
|
351
303
|
final String delimiterString = ",";
|
352
304
|
final String nullString = "";
|
@@ -354,8 +306,9 @@ public class EmbulkOutputDomoOutputPlugin
|
|
354
306
|
final char quote = this.task.getQuoteChar() != '\0' ? this.task.getQuoteChar() : '"';
|
355
307
|
final char escape = this.task.getEscapeChar().or(quotePolicy == QuotePolicy.NONE ? '\\' : quote);
|
356
308
|
final String newlineInField = this.task.getNewlineInField().getString();
|
357
|
-
//ArrayList<StringBuilder> records = new ArrayList<StringBuilder>();
|
358
309
|
|
310
|
+
//int countRecordsBefore = totalRecords;
|
311
|
+
//int i = 1;
|
359
312
|
while (pageReader.nextRecord()) {
|
360
313
|
StringBuilder lineBuilder = new StringBuilder();
|
361
314
|
pageReader.getSchema().visitColumns(new ColumnVisitor() {
|
@@ -434,15 +387,13 @@ public class EmbulkOutputDomoOutputPlugin
|
|
434
387
|
}
|
435
388
|
|
436
389
|
});
|
437
|
-
|
438
|
-
|
439
|
-
//logger.info("Records size = "+ records.size());
|
390
|
+
// allRecords.add(lineBuilder);
|
391
|
+
recordsPage.add(lineBuilder);
|
440
392
|
totalRecords++;
|
393
|
+
// i++;
|
441
394
|
}
|
442
|
-
logger.info(" records = " + totalRecords);
|
443
|
-
|
444
|
-
|
445
395
|
|
396
|
+
// logger.info("Added " + (totalRecords-countRecordsBefore) +" records = " + totalRecords +" all records = "+allRecords.size() +" MISSING = "+(pageReader.getRecordCount(page) - i));
|
446
397
|
}
|
447
398
|
catch (Exception ex) {
|
448
399
|
throw new RuntimeException(ex);
|
@@ -452,12 +403,15 @@ public class EmbulkOutputDomoOutputPlugin
|
|
452
403
|
@Override
|
453
404
|
public void finish()
|
454
405
|
{
|
455
|
-
|
406
|
+
logger.info("FINISH");
|
456
407
|
}
|
457
408
|
|
458
409
|
@Override
|
459
410
|
public void close()
|
460
411
|
{
|
412
|
+
logger.info("CLOSE");
|
413
|
+
logger.info("Records page = "+recordsPage.size());
|
414
|
+
allRecords.addAll(recordsPage);
|
461
415
|
}
|
462
416
|
|
463
417
|
@Override
|
@@ -468,22 +422,9 @@ public class EmbulkOutputDomoOutputPlugin
|
|
468
422
|
@Override
|
469
423
|
public TaskReport commit()
|
470
424
|
{
|
471
|
-
return Exec.newTaskReport();
|
425
|
+
logger.info("COMMIT"); return Exec.newTaskReport();
|
472
426
|
}
|
473
427
|
|
474
|
-
private String stringify(ArrayList<StringBuilder> records) {
|
475
|
-
StringBuilder sb = new StringBuilder();
|
476
|
-
for (StringBuilder s : records)
|
477
|
-
{
|
478
|
-
sb.append(s);
|
479
|
-
//logger.info("Appending {}"+s.toString());
|
480
|
-
sb.append("\n");
|
481
|
-
}
|
482
|
-
return sb.toString();
|
483
|
-
}
|
484
|
-
|
485
|
-
private void executeDomoUpload(int partNum, String csvInput, StreamClient sdsClient, Stream sds, Execution execution) {
|
486
|
-
sdsClient.uploadDataPart(sds.getId(), execution.getId(), partNum, csvInput);
|
487
428
|
}
|
488
429
|
|
489
430
|
private String setEscapeAndQuoteValue(String v, char delimiter, QuotePolicy policy, char quote, char escape, String newline, String nullString)
|
@@ -538,5 +479,51 @@ public class EmbulkOutputDomoOutputPlugin
|
|
538
479
|
|
539
480
|
return String.valueOf(quote) + v + quote;
|
540
481
|
}
|
482
|
+
|
483
|
+
private String stringifyList(List<StringBuilder> records){
|
484
|
+
StringBuilder sb = new StringBuilder();
|
485
|
+
for (StringBuilder s : records)
|
486
|
+
{
|
487
|
+
if(s!=null) {
|
488
|
+
sb.append(s);
|
489
|
+
sb.append("\n");
|
490
|
+
}
|
491
|
+
else{
|
492
|
+
logger.info("NULL Found!");
|
493
|
+
}
|
494
|
+
}
|
495
|
+
return sb.toString();
|
496
|
+
}
|
497
|
+
|
498
|
+
private String stringify(ArrayList<StringBuilder> records) {
|
499
|
+
StringBuilder sb = new StringBuilder();
|
500
|
+
for (StringBuilder s : records)
|
501
|
+
{
|
502
|
+
sb.append(s);
|
503
|
+
sb.append("\n");
|
504
|
+
}
|
505
|
+
return sb.toString();
|
506
|
+
}
|
507
|
+
public static <T> List<List<T>> batches(List<T> input, int chunkSize) {
|
508
|
+
|
509
|
+
int inputSize = input.size();
|
510
|
+
int chunkCount = (int) Math.ceil(inputSize / (double) chunkSize);
|
511
|
+
logger.info("chunkCount = "+chunkCount + " and input size = "+inputSize);
|
512
|
+
|
513
|
+
Map<Integer, List<T>> map = new HashMap<>(chunkCount);
|
514
|
+
List<List<T>> chunks = new ArrayList<>(chunkCount);
|
515
|
+
|
516
|
+
for (int i = 0; i < inputSize; i++) {
|
517
|
+
|
518
|
+
map.computeIfAbsent(i / chunkSize, (ignore) -> {
|
519
|
+
|
520
|
+
List<T> chunk = new ArrayList<>();
|
521
|
+
chunks.add(chunk);
|
522
|
+
return chunk;
|
523
|
+
|
524
|
+
}).add(input.get(i));
|
525
|
+
}
|
526
|
+
|
527
|
+
return chunks;
|
541
528
|
}
|
542
529
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-output-embulk_output_domo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Angelos Alexopoulos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,7 +64,7 @@ files:
|
|
64
64
|
- classpath/junit-4.12.jar
|
65
65
|
- classpath/okhttp-3.7.0.jar
|
66
66
|
- classpath/logging-interceptor-3.7.0.jar
|
67
|
-
- classpath/embulk-output-embulk_output_domo-0.2.
|
67
|
+
- classpath/embulk-output-embulk_output_domo-0.2.1.jar
|
68
68
|
- classpath/hamcrest-core-1.3.jar
|
69
69
|
- classpath/okio-1.12.0.jar
|
70
70
|
homepage: https://github.com/angelosalexopoulos/embulk-output-embulk_output_domo
|