

(where the default argument value is set to None if no database resource is provided.) Note that this function takes an argument dynamodb.This function creates the DynamoDB table ‘Movies’ with the primary-key year (partition-key) and title (sort-key).
Aws local dynamodb db file how to#
We’ll use 3 of the DynamoDB functions shown in the example.īefore we start, we need to think of how to structure them.


The Python and DynamoDB examples used in the AWS documentation is a good reference point, so we can start writing some tests for a few functions. The goal is to share a general idea of how to approach to writing unit tests for your app code and show how to use moto library. In this post, I’ll be explaining an example of using this library to test DynamoDB operations using Python unittest. It allows you to mock AWS services so that you can run unit tests locally, with expected responses from AWS, without actually calling any services/resources on AWS. Moto is a really cool Python library that helped me a lot recently.
