Skip to main content

Create transient, metadata-preserving copies of DynamoDB tables.

Project description

Build Status codecov

DynamoDB Ghost

DynamoDB Ghost is a small Python library providing the ability to create transient, metadata-preserving copies of DynamoDB tables on AWS.

Installation

As easy as pip.

pip install dynamodb-ghost

Usage

The main intention of DynamoDB Ghost is to be used as a testing aid in cases where we wish to apply a set of tests to an existing table without making modifications to the original (e.g. as part of setup)

Using pytests fixtures, a sample test such as:

import pytest
import boto3

@pytest.fixture
def my_table():
    return boto3.resource('dynamodb').Table('my_table')

def test_table(my_table):
    assert ...

insead becomes:

import pytest
import boto3
from dynamodb_ghost import ghost

@pytest.fixture
def my_table():
with ghost(boto3.client('dynamodb'), 'my_table') as ghost_table:
    yield boto3.resource('dynamodb').Table(ghost_table)

def test_table(my_table):
    assert ...

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

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

dynamodb_ghost-0.0.2.tar.gz (6.7 kB view hashes)

Uploaded Source

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