embulk-input-gcs 0.2.2 → 0.2.3

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: 9113cbc31b8a47e6dbb6377c3ae7dcbb3d4f03e5
4
- data.tar.gz: 60744784255a366230bce11a16632b42df6c08f2
3
+ metadata.gz: 206cae7d3839c48e0d5463c12143a602de77d3fa
4
+ data.tar.gz: 2d7215927a470c9ba7540970057b81365a975dd9
5
5
  SHA512:
6
- metadata.gz: 8e1f54da44d5ae5cc84815a76a3a13c9d289be3844ff322c49f3463ac918140193a9eef35d21b319b792c4149c5c03498dbbf0d9ca7123d782608971aaa40251
7
- data.tar.gz: f66b8c1bc9d6d0ed8663b19edfbb815850cf2dd24bb3fc60e1c7cb20a4381a1967d4aef35a05ab3633717d3fb16da616cbf70687e0f74f354fb1b992e1dd55f2
6
+ metadata.gz: d98845cbb8c6d71a464430c6758674fcbb68af5d632723be2289b07f3b69991b0074a1dbbeaa445fa7e4a1a171aa9a3e5b962df4670fb88ec32883348d5eb6f9
7
+ data.tar.gz: d499db32c291a9abc349ea3b0969fb32eea164f06723323167aa9529cd9c2abfbf6135a275439da3d8597687525ff568f7133864674bd553d039be92cf58e407
@@ -1,3 +1,6 @@
1
+ ## 0.2.3 - 2016-08-09
2
+ * [new feature] Support `incremental` option [#24](https://github.com/embulk/embulk-input-gcs/pull/24)
3
+
1
4
  ## 0.2.2 - 2016-08-08
2
5
  * [maintenance] Fix validation logic for `path_prefix` and `paths` options [#23](https://github.com/embulk/embulk-input-gcs/pull/23)
3
6
 
data/README.md CHANGED
@@ -40,6 +40,7 @@ embulk run /path/to/config.yml
40
40
  - **bucket** Google Cloud Storage bucket name (string, required)
41
41
  - **path_prefix** prefix of target keys (string, either of "path_prefix" or "paths" is required)
42
42
  - **paths** list of target keys (array of string, either of "path_prefix" or "paths" is required)
43
+ - **incremental**: enables incremental loading(boolean, optional. default: true. If incremental loading is enabled, config diff for the next execution will include `last_path` parameter so that next execution skips files before the path. Otherwise, `last_path` will not be included.
43
44
  - **auth_method** (string, optional, "private_key", "json_key" or "compute_engine". default value is "private_key")
44
45
  - **service_account_email** Google Cloud Storage service_account_email (string, required when auth_method is private_key)
45
46
  - **p12_keyfile** fullpath of p12 key (string, required when auth_method is private_key)
@@ -17,7 +17,7 @@ configurations {
17
17
  sourceCompatibility = 1.7
18
18
  targetCompatibility = 1.7
19
19
 
20
- version = "0.2.2"
20
+ version = "0.2.3"
21
21
 
22
22
  dependencies {
23
23
  compile "org.embulk:embulk-core:0.8.2"
@@ -59,6 +59,10 @@ public class GcsFileInputPlugin
59
59
  @ConfigDefault("null")
60
60
  Optional<String> getLastPath();
61
61
 
62
+ @Config("incremental")
63
+ @ConfigDefault("true")
64
+ boolean getIncremental();
65
+
62
66
  @Config("auth_method")
63
67
  @ConfigDefault("\"private_key\"")
64
68
  AuthMethod getAuthMethod();
@@ -179,15 +183,17 @@ public class GcsFileInputPlugin
179
183
  ConfigDiff configDiff = Exec.newConfigDiff();
180
184
 
181
185
  List<String> files = new ArrayList<String>(task.getFiles());
182
- if (files.isEmpty()) {
183
- // keep the last value if any
184
- if (task.getLastPath().isPresent()) {
185
- configDiff.set("last_path", task.getLastPath().get());
186
+ if (task.getIncremental()) {
187
+ if (files.isEmpty()) {
188
+ // keep the last value if any
189
+ if (task.getLastPath().isPresent()) {
190
+ configDiff.set("last_path", task.getLastPath().get());
191
+ }
192
+ }
193
+ else {
194
+ Collections.sort(files);
195
+ configDiff.set("last_path", files.get(files.size() - 1));
186
196
  }
187
- }
188
- else {
189
- Collections.sort(files);
190
- configDiff.set("last_path", files.get(files.size() - 1));
191
197
  }
192
198
 
193
199
  return configDiff;
@@ -105,6 +105,7 @@ public class TestGcsFileInputPlugin
105
105
  .set("path_prefix", "my-prefix");
106
106
 
107
107
  GcsFileInputPlugin.PluginTask task = config.loadConfig(PluginTask.class);
108
+ assertEquals(true, task.getIncremental());
108
109
  assertEquals("private_key", task.getAuthMethod().toString());
109
110
  assertEquals("Embulk GCS input plugin", task.getApplicationName());
110
111
  }
@@ -302,6 +303,17 @@ public class TestGcsFileInputPlugin
302
303
  assertEquals(GCP_BUCKET_DIRECTORY + "sample_02.csv", configDiff.get(String.class, "last_path"));
303
304
  }
304
305
 
306
+ @Test
307
+ public void testListFilesByPrefixIncrementalFalse() throws Exception
308
+ {
309
+ ConfigSource config = config().deepCopy()
310
+ .set("incremental", false);
311
+
312
+ ConfigDiff configDiff = runner.transaction(config, new Control());
313
+
314
+ assertEquals("{}", configDiff.toString());
315
+ }
316
+
305
317
  @Test
306
318
  public void testListFilesByPrefixNonExistsBucket()
307
319
  throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-gcs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Satoshi Akama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-08 00:00:00.000000000 Z
11
+ date: 2016-08-09 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
  - src/test/resources/secretkeys.tar.enc
68
68
  - classpath/commons-codec-1.3.jar
69
69
  - classpath/commons-logging-1.1.1.jar
70
- - classpath/embulk-input-gcs-0.2.2.jar
70
+ - classpath/embulk-input-gcs-0.2.3.jar
71
71
  - classpath/google-api-client-1.21.0.jar
72
72
  - classpath/google-api-services-storage-v1-rev59-1.21.0.jar
73
73
  - classpath/google-http-client-1.21.0.jar