embulk-output-dynamodb 0.1.0 → 0.1.1

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: 0c86de91e5c36f167f01b9a3d9510eed81d58527
4
- data.tar.gz: 01ca2686938850340d6d6aeb166aa78833ea2603
3
+ metadata.gz: e66af28e6496f009130c40476f4b3ca099290a78
4
+ data.tar.gz: 82ddcf4c42bbaf759abe827545fbc54469616ebc
5
5
  SHA512:
6
- metadata.gz: 3f3b54201891fb212456b7403dd45bb6a2c7037bb592b67bdba8d51cbf9dacf0097d9e27f8b08c6a4b8280e061f9e981e2c82b97870072b339aaab24b8ed03c2
7
- data.tar.gz: 3ff9b88e413a761ff8be4e40abab6c3418a0443fcfb2dedd09e9100b640c03990c5a1dcee82db220d3dc4410a69f2fc3a619873f3606c678eb882f73cf2e7730
6
+ metadata.gz: 2f13b2fee493844489cbaa3f66719989688b640dbc43c4a23a209d2231a53142cfbe600e3985b0a7bb3caf1e5fa031c7b8e29058019c48eff622cce0397fcea9
7
+ data.tar.gz: a5a6067389d16393c33043f0190d1870fe319609c5a2606e3b10ddf2eee8f1bcbfee6e4ea1d95c519d8ba5392ff21bb543b0f1a9c01f69caae827409b4a0713c
@@ -1 +1 @@
1
- ## 0.1.0 - 2016-05-13
1
+ ## 0.1.1 - 2016-05-16
data/README.md CHANGED
@@ -51,6 +51,8 @@
51
51
  type: dynamodb
52
52
  table: table_%Y_%m
53
53
  ```
54
+ - **primary_key** (string, required when use auto_create_table) primary key name
55
+ - **primary_key_type** (string, required when use auto_create_table) primary key type
54
56
  - **write_capacity_units** (int optional) Provisioned write capacity units
55
57
  - **normal** (int optional) value that will be set after execution
56
58
  - **raise** (int optional) value that will be set before execution
@@ -178,6 +180,8 @@ out:
178
180
  secret_access_key: ABCXYZ123ABCXYZ123
179
181
  auto_create_table: true
180
182
  table: dynamotable
183
+ primary_key: id
184
+ primary_key_type: Number
181
185
  write_capacity_units:
182
186
  normal: 5
183
187
  raise: 20
@@ -201,7 +205,7 @@ $ ./gradlew test # -t to watch change of files and rebuild continuously
201
205
 
202
206
  To run unit tests, you need to setup DynamoDB on your local environment.
203
207
  Please reference the documentation [Running DynamoDB on Your Computer](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html) on AWS Developer Guide.
204
- ```
208
+ ```shell-session
205
209
  $ mkdir /path/to/dynamodb
206
210
  $ cd /path/to/dynamodb
207
211
  $ wget http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest.tar.gz
@@ -14,7 +14,7 @@ configurations {
14
14
  provided
15
15
  }
16
16
 
17
- version = "0.1.0"
17
+ version = "0.1.1"
18
18
 
19
19
  sourceCompatibility = 1.7
20
20
  targetCompatibility = 1.7
@@ -85,9 +85,11 @@ public class DynamodbOutputPlugin
85
85
  Optional<String> getEndpoint();
86
86
 
87
87
  @Config("primary_key")
88
+ @ConfigDefault("null")
88
89
  Optional<String> getPrimaryKey();
89
90
 
90
91
  @Config("primary_key_type")
92
+ @ConfigDefault("null")
91
93
  Optional<String> getPrimaryKeyType();
92
94
 
93
95
  @Config("sort_key")
@@ -177,6 +177,11 @@ public class DynamodbUtils
177
177
  protected void createTable(DynamoDB dynamoDB, DynamodbOutputPlugin.PluginTask task)
178
178
  throws InterruptedException
179
179
  {
180
+ String tableName = task.getTable();
181
+ if (isExistsTable(dynamoDB, tableName)) {
182
+ log.info("Table[{}] is already exists", tableName);
183
+ return;
184
+ }
180
185
  ArrayList<KeySchemaElement> keySchema = getKeySchemaElements(task);
181
186
  ArrayList<AttributeDefinition> attributeDefinitions = getAttributeDefinitions(task);
182
187
  ProvisionedThroughput provisionedThroughput = new ProvisionedThroughput()
@@ -184,15 +189,15 @@ public class DynamodbUtils
184
189
  .withWriteCapacityUnits(task.getWriteCapacityUnits().get().getNormal().get());
185
190
 
186
191
  dynamoDB.createTable(new CreateTableRequest()
187
- .withTableName(task.getTable())
192
+ .withTableName(tableName)
188
193
  .withKeySchema(keySchema)
189
194
  .withAttributeDefinitions(attributeDefinitions)
190
195
  .withProvisionedThroughput(provisionedThroughput)
191
196
  );
192
197
 
193
- Table table = dynamoDB.getTable(task.getTable());
198
+ Table table = dynamoDB.getTable(tableName);
194
199
  table.waitForActive();
195
- log.info(String.format("Created table '%s'", task.getTable()));
200
+ log.info("Created table[{}]", tableName);
196
201
  }
197
202
 
198
203
  protected void deleteTable(DynamoDB dynamoDB, String tableName)
@@ -208,7 +213,6 @@ public class DynamodbUtils
208
213
  throws InterruptedException
209
214
  {
210
215
  Table table = dynamoDB.getTable(tableName);
211
- TableDescription description = null;
212
216
  try {
213
217
  switch (table.describe().getTableStatus()) {
214
218
  case "CREATING":
@@ -1,10 +1,5 @@
1
1
  package org.embulk.output.dynamodb;
2
2
 
3
- import org.embulk.spi.TestPageBuilderReader.MockPageOutput;
4
- import org.junit.BeforeClass;
5
-
6
- import static org.junit.Assume.assumeNotNull;
7
-
8
3
  public class TestDynamodbUtils
9
4
  {
10
5
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-output-dynamodb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
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-05-13 00:00:00.000000000 Z
11
+ date: 2016-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -70,7 +70,7 @@ files:
70
70
  - classpath/aws-java-sdk-s3-1.10.50.jar
71
71
  - classpath/commons-codec-1.6.jar
72
72
  - classpath/commons-logging-1.1.3.jar
73
- - classpath/embulk-output-dynamodb-0.1.0.jar
73
+ - classpath/embulk-output-dynamodb-0.1.1.jar
74
74
  - classpath/httpclient-4.3.6.jar
75
75
  - classpath/httpcore-4.3.3.jar
76
76
  homepage: