embulk-output-embulk_output_domo 0.3.1 → 0.3.2

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: a43474cd86b39442338ad57734bcc0c70fe123ae
4
- data.tar.gz: 05c2e28fecf1292959564790a9c9a141e06292f9
3
+ metadata.gz: 3978b59b3985b4520d50f23256d3708bda278d3c
4
+ data.tar.gz: 2324808afdd8b2ba25934dbbffd95eecfabd8cb0
5
5
  SHA512:
6
- metadata.gz: 2e41586ca7938d74a76776a589488cb493f873bf452f62fbef6b9012b7092b9e58890a810768e4ff9e2953df0a55db1a1a414dce2a3d33c09f2f18628e04f1f7
7
- data.tar.gz: a41debd9b92b3febe60154e9a044e3b420315ad6c8f1cc8d846393ddff3199811192188f0550a63f0e34edbc7fea32d13ece05b987f99ca7cf0862d4af181bd2
6
+ metadata.gz: cef3cb441fb4d03a5e290747d61e08bc38fa31943cd165c70d0908d809aad1b3c023e2a8cd876f0ed2073a598eb461664bf749b8b1b7011850dfd5168f736fd8
7
+ data.tar.gz: 640715724ddb4e0ad5e9abc1dd9fe490dc803ad7ab4c9b16a6454ece9099d6a8d3f28fbce4bdc6e29a763fc61178f833653acc9aea7df130b0ffc3b35d28a221
data/README.md CHANGED
@@ -17,17 +17,17 @@ embulk gem install embulk-output-embulk_output_domo
17
17
 
18
18
  ## Configuration
19
19
 
20
- - **clientId**: description (string, required)
21
- - **clientSecret**: description (string, required)
22
- - **apiHost**: description (string, default: `"api.domo.com"`)
23
- - **useHttps**: description (boolean, default: `true`)
24
- - **streamName**: description (string, required)
25
- - **column_options**: description (object, default: `Check embulk column options`)
26
- - **batchSize**: description (integer, default: `1000`)
27
- - **quote**: description (string, default: `"\""`)
28
- - **quote_policy**: description (string, default: `MINIMAL`)
29
- - **escape**: description (string, default: `null`)
30
- - **newline_in_field**: description (string, default: `LF`)
20
+ - **clientId**: Domo Client Id (string, required)
21
+ - **clientSecret**: Domo Client Secret (string, required)
22
+ - **apiHost**: api host address (string, default: `"api.domo.com"`)
23
+ - **useHttps**: use https? (boolean, default: `true`)
24
+ - **streamName**: name of the Domo Stream (string, required)
25
+ - **column_options**: Embulk Column Options (used mainly for timestamps formatting) (object, default: `Check embulk column options`)
26
+ - **batchSize**: Number of csv files to be zipped and send for each upload request. Each csv has like 50 records. (integer, default: `1000`)
27
+ - **quote**: CSV Quote symbol (See csv embulk plugin for more info) (string, default: `"\""`)
28
+ - **quote_policy**: CSV Quote Policy (string, default: `MINIMAL`)
29
+ - **escape**: CSV Escape Character (string, default: `null`)
30
+ - **newline_in_field**: CSV New Line (string, default: `LF`)
31
31
 
32
32
 
33
33
  ## Example
data/build.gradle CHANGED
@@ -13,7 +13,7 @@ configurations {
13
13
  provided
14
14
  }
15
15
 
16
- version = "0.3.1"
16
+ version = "0.3.2"
17
17
 
18
18
  sourceCompatibility = 1.8
19
19
  targetCompatibility = 1.8
@@ -160,6 +160,49 @@ public class EmbulkOutputDomoOutputPlugin
160
160
  Newline getNewlineInField();
161
161
  }
162
162
 
163
+ public com.domo.sdk.datasets.model.Schema getDomoSchema(Schema schema){
164
+ /**
165
+ * We need to return domo Schema
166
+ * e.g. new com.domo.sdk.datasets.model.Schema(Lists.newArrayList(new Column(STRING, "Friend"), new Column(STRING, "Attending")))
167
+ */
168
+ ArrayList<com.domo.sdk.datasets.model.Column> domoSchema = new ArrayList<com.domo.sdk.datasets.model.Column>();
169
+ for (int i = 0; i < schema.size(); i++) {
170
+ Column column = schema.getColumn(i);
171
+ Type type = column.getType();
172
+ System.out.println("{\n" +
173
+ " \"type\" : \""+type.getName().toUpperCase()+"\",\n" +
174
+ " \"name\" : \""+column.getName() +"\"\n" +
175
+ " },");
176
+ switch (type.getName()) {
177
+ case "long":
178
+ domoSchema.add(new com.domo.sdk.datasets.model.Column(ColumnType.LONG, column.getName()));
179
+ break;
180
+ case "double":
181
+ // System.out.println("Double Column" + column.getName());
182
+ domoSchema.add(new com.domo.sdk.datasets.model.Column(ColumnType.DOUBLE, column.getName()));
183
+ break;
184
+ case "boolean":
185
+ domoSchema.add(new com.domo.sdk.datasets.model.Column( ColumnType.LONG, column.getName()));
186
+ break;
187
+ case "string":
188
+ domoSchema.add(new com.domo.sdk.datasets.model.Column(ColumnType.STRING, column.getName()));
189
+ break;
190
+ case "timestamp":
191
+ domoSchema.add(new com.domo.sdk.datasets.model.Column( ColumnType.DATETIME, column.getName()));
192
+ break;
193
+ default:
194
+ logger.info("Unsupported type " + type.getName());
195
+ break;
196
+ }
197
+ }
198
+ if(domoSchema != null && domoSchema.size()>0){
199
+ return new com.domo.sdk.datasets.model.Schema(domoSchema);
200
+ }
201
+ else{
202
+ logger.error("Cannot create domo schema");
203
+ throw new RuntimeException("Cannot create domo Schema");
204
+ }
205
+ }
163
206
 
164
207
  @Override
165
208
  public ConfigDiff transaction(ConfigSource config,
@@ -238,7 +281,7 @@ public class EmbulkOutputDomoOutputPlugin
238
281
  Runnable partUpload = () -> streamClient.uploadDataPart(sds.getId(), execution.getId(), myPartNum, compressedCsvFile);
239
282
  uploadTasks.add(Executors.callable(partUpload));
240
283
  partNum++;
241
- }
284
+ }
242
285
  // Asynchronously execute all uploading tasks
243
286
  try {
244
287
  executorService.invokeAll(uploadTasks);
@@ -294,7 +337,7 @@ public class EmbulkOutputDomoOutputPlugin
294
337
  public DomoPageOutput(final PageReader pageReader,
295
338
  DomoClient client, PluginTask task, Schema schema)
296
339
  {
297
- logger.info("NEW PAGE CONSTRUCTOR!!");
340
+ logger.info("NEW PAGE CONSTRUCTOR!!!");
298
341
  this.pageReader = pageReader;
299
342
  this.client = client;
300
343
  this.task = task;
@@ -345,7 +388,7 @@ public class EmbulkOutputDomoOutputPlugin
345
388
  public void doubleColumn(Column column) {
346
389
  addDelimiter(column);
347
390
  if (!pageReader.isNull(column)) {
348
- addValue(Long.toString(pageReader.getLong(column)));
391
+ addValue(Double.toString(pageReader.getDouble(column)));
349
392
  } else {
350
393
  addNullString();
351
394
  }
@@ -658,51 +701,5 @@ public class EmbulkOutputDomoOutputPlugin
658
701
  bw.close();
659
702
  }
660
703
 
661
- /**
662
- * Get Domo Schema
663
- * @param schema
664
- * @return
665
- */
666
- public com.domo.sdk.datasets.model.Schema getDomoSchema(Schema schema){
667
- /**
668
- * We need to return domo Schema
669
- * e.g. new com.domo.sdk.datasets.model.Schema(Lists.newArrayList(new Column(STRING, "Friend"), new Column(STRING, "Attending")))
670
- */
671
- ArrayList<com.domo.sdk.datasets.model.Column> domoSchema = new ArrayList<com.domo.sdk.datasets.model.Column>();
672
- for (int i = 0; i < schema.size(); i++) {
673
- Column column = schema.getColumn(i);
674
- Type type = column.getType();
675
- System.out.println("{\n" +
676
- " \"type\" : \""+type.getName().toUpperCase()+"\",\n" +
677
- " \"name\" : \""+column.getName() +"\"\n" +
678
- " },");
679
- switch (type.getName()) {
680
- case "long":
681
- domoSchema.add(new com.domo.sdk.datasets.model.Column(ColumnType.LONG, column.getName()));
682
- break;
683
- case "double":
684
- domoSchema.add(new com.domo.sdk.datasets.model.Column(ColumnType.DOUBLE, column.getName()));
685
- break;
686
- case "boolean":
687
- domoSchema.add(new com.domo.sdk.datasets.model.Column( ColumnType.LONG, column.getName()));
688
- break;
689
- case "string":
690
- domoSchema.add(new com.domo.sdk.datasets.model.Column(ColumnType.STRING, column.getName()));
691
- break;
692
- case "timestamp":
693
- domoSchema.add(new com.domo.sdk.datasets.model.Column( ColumnType.DATETIME, column.getName()));
694
- break;
695
- default:
696
- logger.info("Unsupported type " + type.getName());
697
- break;
698
- }
699
- }
700
- if(domoSchema != null && domoSchema.size()>0){
701
- return new com.domo.sdk.datasets.model.Schema(domoSchema);
702
- }
703
- else{
704
- logger.error("Cannot create domo schema");
705
- throw new RuntimeException("Cannot create domo Schema");
706
- }
707
- }
704
+
708
705
  }
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.3.1
4
+ version: 0.3.2
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-23 00:00:00.000000000 Z
11
+ date: 2018-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +67,7 @@ files:
67
67
  - classpath/commons-io-2.6.jar
68
68
  - classpath/hamcrest-core-1.3.jar
69
69
  - classpath/okio-1.12.0.jar
70
- - classpath/embulk-output-embulk_output_domo-0.3.1.jar
70
+ - classpath/embulk-output-embulk_output_domo-0.3.2.jar
71
71
  homepage: https://github.com/alexopoulos7/embulk-output-embulk_output_domo
72
72
  licenses:
73
73
  - MIT