Support Questions
Find answers, ask questions, and share your expertise

PutDynamoDb example

Highlighted

PutDynamoDb example

New Contributor

Can someone please post an example of how to configure a PutDynamoDB processor.

I have a table kv where:

Primary partition key: k Primary sort key: v

example json string {"k":"123","v":"value123"}

What should I use for:

Hash Key Name?

Range Key Name?

Json Document attribute?

You are welcome to provide a better example with corresponding properties and values.

4 REPLIES 4
Highlighted

Re: PutDynamoDb example

Mentor

take a look at the mock tests for dynamodb processors for examples https://github.com/mans2singh/nifi/commit/75857ea80739035bc8666efbb8540bf61fa97392 and here's the jira describing the effort https://issues.apache.org/jira/browse/NIFI-1516

here's a snippet from tests

putRunner.setProperty(AbstractDynamoDBProcessor.CREDENTIALS_FILE, CREDENTIALS_FILE);
putRunner.setProperty(AbstractDynamoDBProcessor.REGION, REGION);
putRunner.setProperty(AbstractDynamoDBProcessor.TABLE, stringHashStringRangeTableName);
putRunner.setProperty(AbstractDynamoDBProcessor.HASH_KEY_NAME, "hashS");
putRunner.setProperty(AbstractDynamoDBProcessor.HASH_KEY_VALUE, "h1");
putRunner.setProperty(AbstractDynamoDBProcessor.RANGE_KEY_NAME, "rangeS");
putRunner.setProperty(AbstractDynamoDBProcessor.RANGE_KEY_VALUE, "r1");
putRunner.setProperty(AbstractWriteDynamoDBProcessor.JSON_DOCUMENT, "document");
Highlighted

Re: PutDynamoDb example

New Contributor

@Artem Ervits this example doesnt show how to parse the json. I tried ${keyName} and the default one. both didnt work.

Re: PutDynamoDb example

Were you able to figure out how it should be configured? These set of processors are poorly documented.

Highlighted

Re: PutDynamoDb example

Explorer

@tcpip001to set hash key in your case you must create an EvaluateJsonPath and add a new attribute for each property that you're using, following your example:

For Hash Key:

Property: hashKey

Value: $.k

For Range Key I believe that is the same process:

Property: rangeKey

Value: $.v

 

And finally go to PutDynamoDb processor and put in the properties:

Hash Key Value: ${hashKey}

Range Key Value: ${rangeKey}

 

I hope this could help you.