How to write a dictionary entry to a dynamodb table using DSS
![dromero](https://us.v-cdn.net/6038231/uploads/Dataiku/nAvatar14.png)
I have prepared the dictionary I want to write to dynamodb. How can I 'put' that record into dynamodb. I already have a connection to it in my project.
Thanks.
Answers
-
Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,211 Dataiker
Hi,
If you have already set up the Connector for DynamoDB it would handle the writing to DynamoDB https://www.dataiku.com/product/plugins/dynamodb/
1) You need to convert yourr dictionary to a pandas dataframe using :
df = pd.DataFrame.from_dict(actual_dict)
2_ Then write the data frame to DynamoDB Dataset using write_with_schema()
By default, it will drop the table if it already exists in DynamoDB and recreate it with the new data. If this is not the behavior you are looking for you can also use append for the DynamoDB output dataset.
Here are a few screenshots with a basic example a simple python recipe that essentially write the input dataset to DynamoDB:
Flow
DynamoDB Dataset settings :
Recipe:
Written Dataset in DynamoDB
Hope this helps!