Skip to content
This repository has been archived by the owner. It is now read-only.
AWS DynamoDB bindings for the microcosm framework
Branch: develop
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
microcosm_dynamodb
.ackrc
.bumpversion.cfg
.gitignore
.pullapprove.yml
CONTRIBUTING.md
LICENSE
README.md
circle.yml
setup.cfg
setup.py
tox.ini

README.md

microcosm-dynamodb

Opinionated persistence with AWS DynamoDB.

Circle CI

Usage

This project includes example models and persistence stores. Assuming the testing database exists (see below), the following demonstrates basic usage:

from microcosm.api import create_object_graph
from microcosm_dynamodb.example import Company

# create the object graph
graph = create_object_graph(name="example", testing=True)

# wire up the persistence layer to the (testing) database
[company_store] = graph.use("company_store")

# create a model
company = company_store.create(Company(name="Acme"))

# prints 1
print company_store.count()

Convention

Models:

  • Persistent models use a flywheel declarative base class
  • Persistent operations pass through a unifying Store layer

Configuration

To change the database region:

config.dynamodb.region = "us-west-2"

Test Setup

Tests (and automated builds) will use a MockEngine. Tests can also be run using a real DynamoDB (using the test- namespace).

To enable real tests, modify the appropriate unit test (e.g. test_example.py) to configure the graph with testing=False. in this case:

To run all tests that do not involve actually hitting AWS APIs, you can exclude tests using the 'aws' tag:

nosetests -a '!aws'
You can’t perform that action at this time.