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 +4 -4
- data/CHANGELOG.md +1 -1
- data/README.md +5 -1
- data/build.gradle +1 -1
- data/src/main/java/org/embulk/output/dynamodb/DynamodbOutputPlugin.java +2 -0
- data/src/main/java/org/embulk/output/dynamodb/DynamodbUtils.java +8 -4
- data/src/test/java/org/embulk/output/dynamodb/TestDynamodbUtils.java +0 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e66af28e6496f009130c40476f4b3ca099290a78
|
4
|
+
data.tar.gz: 82ddcf4c42bbaf759abe827545fbc54469616ebc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f13b2fee493844489cbaa3f66719989688b640dbc43c4a23a209d2231a53142cfbe600e3985b0a7bb3caf1e5fa031c7b8e29058019c48eff622cce0397fcea9
|
7
|
+
data.tar.gz: a5a6067389d16393c33043f0190d1870fe319609c5a2606e3b10ddf2eee8f1bcbfee6e4ea1d95c519d8ba5392ff21bb543b0f1a9c01f69caae827409b4a0713c
|
data/CHANGELOG.md
CHANGED
@@ -1 +1 @@
|
|
1
|
-
## 0.1.
|
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
|
data/build.gradle
CHANGED
@@ -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(
|
192
|
+
.withTableName(tableName)
|
188
193
|
.withKeySchema(keySchema)
|
189
194
|
.withAttributeDefinitions(attributeDefinitions)
|
190
195
|
.withProvisionedThroughput(provisionedThroughput)
|
191
196
|
);
|
192
197
|
|
193
|
-
Table table = dynamoDB.getTable(
|
198
|
+
Table table = dynamoDB.getTable(tableName);
|
194
199
|
table.waitForActive();
|
195
|
-
log.info(
|
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":
|
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.
|
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-
|
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.
|
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:
|