dynamongo: Pythonic DynamoDB models
dynamongo is Python ORM/framework-agnostic library for DynamoDB. It is highly inspired by the PyMongo project. This documentation attempts to explain everything you need to know to use dynamongo.
import datetime
from dynamongo import Model, Connection
from dynamongo import IntField, StringField, ListField, EmailField, DateTimeField
# This only need be called once. Alternatively, it can be set using env variables
Connection.set_config(
access_key_id='<KEY>',
secret_access_key='<SECRET>',
table_prefix='test-'
)
class User(Model):
__table__ = 'users'
__hash_key__ = 'email'
email = EmailField(required=True)
name = StringField(required=True)
year_of_birth = IntField(max_value=2018, min_value=1900)
cities_visited = ListField(StringField)
created_at = DateTimeField(default=datetime.datetime.now)
# store data to DynamoDB
john = User.save_one({
'email': 'johndoe@gmail.com',
'name': 'John Doe',
'year_of_birth': 1990,
'cities_visited': ['Nairobi', 'New York']
})
# year_of_birth, cities_visited & created_at are all optional
jane = User.save_one({
'email': 'jane@gmail.com',
'name': 'Jane Doe'
})
# Access attribute values
print(john.name)
# Fetch data from dynamoDB
user = User.get_one(User.email == 'johndoe@gmail.com')
print(user.to_dict())
In short, dynamongo models can be used to easily:
validate input data
save serialized data to DynamoDB
read and deserialize data from DynamoDB
delete items from DynamoDB
update data in DynamoDB
Get It Now
$ pip install dynamongo
Documentation
Full documentation is available at http://dynamongo.readthedocs.io/ .
Requirements
Python >= 3.5
Metadata
Release files for dynamongo 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dynamongo-0.1.tar.gz | 31.2 kB | Without provenance | Details for dynamongo-0.1.tar.gz |
Release files / dynamongo-0.1.tar.gz
| Download URL | dynamongo-0.1.tar.gz |
|---|---|
| Size | 31.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e6edb535a52ff816c16124a342ca583741f25fdbf5b0a560067d82dda9fe3e03
|
|
BLAKE2b-256 checksum How to use checksums |
5ea771c0a7b8e4bf20acb953e9cf282f62bbb627e06f1cf9360e07a3970db7a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.5.3
|
Security for dynamongo 0.1
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.