How to write a dictionary entry to a dynamodb table using DSS

Options
dromero
dromero Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS Core Concepts, Registered Posts: 4 ✭✭✭✭

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
    Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,209 Dataiker
    Options

    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

    Screenshot 2021-11-11 at 21.44.25.png

    DynamoDB Dataset settings :

    Screenshot 2021-11-11 at 21.44.45.png

    Recipe:

    Screenshot 2021-11-11 at 21.46.29.png

    Written Dataset in DynamoDB

    Screenshot 2021-11-11 at 21.46.13.png

    Hope this helps!

Setup Info
    Tags
      Help me…