Skip to main content

Amazon DynamoDB mock implementation

Project description

ddbmock – a DynamoDB mock implementation.

Presentation

DynamoDB is a minimalistic NoSQL engine provided by Amazon as a part of their AWS product.

DynamoDB allows you to store documents composed of unicode, number or binary data as well are sets. Each tables must define a hash_key and may define a range_key. All other fields are optional.

DynamoDB is really awesome but is terribly slooooow with managment tasks. This makes it completly unusable in test environements

ddbmock brings a nice, tiny, in-memory 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 DynamoDB

  • embeded entry-point with seamless boto intergration 1, ideal to avoid spinning yet another server.

Current status

ddbmock is an experimental project and is currently under heavy development. It also may be discontinued at any time.

  • support full table life-cycle

  • support full item life-cycle

  • preliminary support of Query, Scan and BatchGetItem

  • support (almost) all types restrictions

  • no limits on table number nor concurent table operations

  • no limits on item size

  • no limits for request/response size nor item count in those

See CHANGELOG for up-to-date status.

Example usage

Run as Regular client-server

Ideal for test environment. For stage and production I highly recommend using DynamoDB servers. ddbmock comes with no warranty and will loose your data(tm).

$ pserve development.ini # launch the server on 0.0.0.0:6543
import boto
from ddbmock import connect_ddbmock

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

# 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_ddbmock(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 library

Ideal 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

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

# Done ! just use it wherever in your project as usual.
db.list_tables() # get list of tables (empty at this stage)

Requirements

  • Python 2.7.x

  • Pyramid >= 1.3

  • Boto >= 2.5.0 (optional)

  • NO AWS account :)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ddbmock-0.3.0.tar.gz (33.9 kB view details)

Uploaded Source

File details

Details for the file ddbmock-0.3.0.tar.gz.

File metadata

  • Download URL: ddbmock-0.3.0.tar.gz
  • Upload date:
  • Size: 33.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ddbmock-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e606bfb9588008bc4ff58a8069c5ba0a5de4eb43d067b6c882a4cb508f97a6a0
MD5 1f26abc5b9be985533df3a6148db79e8
BLAKE2b-256 6fea229a5d7897bb0ede1900e0c93f6753a25b33f59bfaf58969d4c2b9839063

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page