Package: ddbmock
ddbmock – a DynamoDB mock implementation.PresentationDynamoDBis a minimalistic NoSQL engine
provided by Amazon as a part of their AWS product.DynamoDBallows you to store documents composed of unicode, number or binary
data as well are sets. Each tables must define ahash_keyand may define arange_key. All other fields are optional.DynamoDBis really awesome but is terribly slooooow with managment tasks.
This makes it completly unusable in test environements.ddbmockbrings a nice, tiny, in-memory or sqlite implementation of
DynamoDB along with much better and detailed error messages. Among its niceties,
it features a double entry point:regular network based entry-point with 1:1 correspondance with stock DynamoDBembeded entry-pointwith seamless boto intergration 1, ideal to avoid spinning yet another server.ddbmockisnotintended for production use. Itwill loseyour data.
you’ve been warned! I currently recommend the “boto extension” mode for unit-tests
and the “server” mode for functional tests.Installation$ pip install ddbmockDeveloping$ hg clone ssh://hg@bitbucket.org/Ludia/dynamodb-mock
$ pip install nose nosexcover coverage mock webtest boto
$ python setup.py develop
$ nosetests # --no-skip to run boto integration tests tooWhat is ddbmocknotuseful for ?Donotuse it in production or as a cheap DynamoDB replacement. I’ll never
stress it enough.All the focus was on simplicity/hackability and simulation quality. Nothing else.What is ddbmock useful for ?FAST and RELIABLE unit testingFAST and RELIABLE functional testingexperiment with DynamoDB API.RELIABLE throughput planificationRELIABLE disk space planificationalmost any DynamoDB simulation !ddbmock can also persist your data in SQLITE. This open another vast range of
possibilities :)Current statuspass all boto integration testssupport full table life-cyclesupport full item life-cyclesupport for all item limitationsaccurate size, throughput reportingno limits on concurent table operationsno limits for request/response size nor item count in theseSeehttp://ddbmock.readthedocs.org/en/latest/pages/status.htmlfor detailed
up-to-date status.Historyv1.0.0 (*): full documentation and bugfixesv0.4.1: schema persistence + thread safety, bugfixesv0.4.0: sqlite backend + throughput statistics + refactoring, more documentation, more testsv0.3.2: batchWriteItem support + pass boto integration testsv0.3.1: accuracy in item/table sizes + full test coveragev0.3.0: first public release. Full table lifecycle + most items operations(?) indicates a future release. These are only ideas or “nice to have”.Example usageRun as Regular client-serverIdeal for test environment. For stage and production I highly recommend using
DynamoDB servers. ddbmock comes with no warranty andwillloose your data(tm).Launch the server$ pserve development.ini # launch the server on 0.0.0.0:6543Start the clientimport boto
from ddbmock import connect_boto_network

# Use the provided helper to connect your *own* endpoint
db = connect_boto_network()

# Done ! just use it wherever in your project as usual.
db.list_tables() # get list of tables (empty at this stage)Note: if you do not want to import ddbmock only for the helper, here is a
reference implementation:def connect_boto_network(host='localhost', port=6543):
    import boto
    from boto.regioninfo import RegionInfo
    endpoint = '{}:{}'.format(host, port)
    region = RegionInfo(name='ddbmock', endpoint=endpoint)
    return boto.connect_dynamodb(region=region, port=port, is_secure=False)Run as a standalone libraryIdeal for unit testing or small scale automated functional tests. Nice to play
around with boto DynamoDB API too :)import boto
from ddbmock import connect_boto_patch

# Wire-up boto and ddbmock together
db = connect_boto_patch()

# Done ! just use it wherever in your project as usual.
db.list_tables() # get list of tables (empty at this stage)Note, to clean patches made inboto.dynamodb.layer1, you can callclean_boto_patch()from  the same module.RequirementsPython 2.7.xPyramid >= 1.3Boto >= 2.5.0 (optional)NOAWS account :)Related LinksddbmockFull documentation:https://ddbmock.readthedocs.org/en/latestReport bugs:https://bitbucket.org/Ludia/dynamodb-mock/issuesDownload:http://pypi.python.org/pypi/ddbmockDynamodb-mapperFull documentation:http://dynamodb-mapper.readthedocs.org/en/latest/Report bugs:https://bitbucket.org/Ludia/dynamodb-mapper/issuesDownload:http://pypi.python.org/pypi/dynamodb-mapperBotoFull documentation:http://docs.pythonboto.org/en/latest/index.htmlReport bugs:https://github.com/boto/boto/issuesDownload:http://pypi.python.org/pypi/boto