Skip to main content

DynamoDB + Marshmallow == Dynamallow

https://img.shields.io/travis/borgstrom/dynamallow.svg https://img.shields.io/codecov/c/github/borgstrom/dynamallow.svg Latest PyPI version Number of PyPI downloads

This package is a work in progress – Feedback / Suggestions / Etc welcomed!

Two awesome things, better together!

Dynamallow is a Python library that provides integration between the Boto v3 DynamoDB API and Marshmallow. Together they provide a simple, ORM inspired, interface to the DynamoDB service with a fully defined, strongly typed schema.

from dynamallow import MarshModel
from marshmallow import fields

class Book(MarshModel):
    class Table:
        name = 'prod-books'
        hash_key = 'isbn'
        read = 25
        write = 5

    class Schema:
        isbn = fields.String(validate=validate_isbn)
        title = fields.String()
        author = fields.String()
        publisher = fields.String()
        year = fields.Number()


# Store new documents directly from dictionaries
Book.put({
    "isbn": "12345678910",
    "title": "Foo",
    "author": "Mr. Bar",
    "publisher": "Publishorama"
})

# Work with the classes as objects
# You can pass attributes from the schema to the constructor
foo = Book(isbn="12345678910", title="Foo", author="Mr. Bar",
           publisher="Publishorama")
foo.save()

# Or assign attributes
foo = Book()
foo.isbn = "12345678910"
foo.title = "Foo"
foo.author = "Mr. Bar"
foo.publisher = "Publishorama"
foo.save()

# In all cases they go through Schema validation, calls to
# .put or .save can result in ValidationError being raised.

# You can then fetch, query and scan your tables.

# Get on the hash key, and/or range key
Book.get(isbn="12345678910")

# Query based on the keys
Book.query(isbn__begins_with="12345")

# Scan based on attributes
Book.scan(author="Mr. Bar")
Book.scan(author__ne="Mr. Bar")

Documentation

Full documentation can be found online at:

http://borgstrom.github.io/dynamallow/

TODO

  • Indexes – Currently there is no support for indexes.

  • Schema Migrations

  • Partial updates on save()

Metadata

Release files for dynamallow 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dynamallow 0.0.3
File Size Uploaded Provenance
dynamallow-0.0.3.tar.gz 10.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for dynamallow 0.0.3
File Interpreter ABI Platform
dynamallow-0.0.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 25.5 kB

Release files / dynamallow-0.0.3.tar.gz

Download URL dynamallow-0.0.3.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9e15ac0f310df0074823199df0f2c8b0b01202fc3a59d1c0a8b999848194206c
BLAKE2b-256 checksum
How to use checksums
982b19e2d7fb39a6552843aa0c9a818fc633f1b6136f4ca8974b81a2fef61118
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / dynamallow-0.0.3-py2.py3-none-any.whl

Download URL dynamallow-0.0.3-py2.py3-none-any.whl
Size 15.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
271fe5c68b39d20d126284649deb4c5a0c59ff8f938492b6d41059c37fc01077
BLAKE2b-256 checksum
How to use checksums
f4d4575cc74cba280993f85d6e61f1fed9aaee7ceb1911e7e2d6974abd273892
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for dynamallow 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page