PynamoDB integration with the marshmallow (de)serialization library
Project description
========
marshmallow-pynamodb
========
Installation
============
From PyPi::
$ pip install marshmallow-pynamodb
Declare your models
===================
.. code-block:: python
from pynamodb.models import Model
from pynamodb.attributes import UnicodeAttribute
class User(Model):
class Meta:
table_name = "user"
email = UnicodeAttribute(null=True)
first_name = UnicodeAttribute(range_key=True)
last_name = UnicodeAttribute(hash_key=True)
Generate marshmallow schemas
============================
.. code-block:: python
from marshmallow_pynamodb import ModelSchema
class UserSchema(ModelSchema):
class Meta:
model = User
user_schema = UserSchema()
(De)serialize your data
=======================
.. code-block:: python
user = User(last_name="Smith", first_name="John")
author_schema.dump(user).data
# {u'first_name': u'John', u'last_name': u'Smith', u'email': None}
author_schema.load({"last_name": "Smith", "first_name": "John"}).data
# user<Smith>
marshmallow-pynamodb
========
Installation
============
From PyPi::
$ pip install marshmallow-pynamodb
Declare your models
===================
.. code-block:: python
from pynamodb.models import Model
from pynamodb.attributes import UnicodeAttribute
class User(Model):
class Meta:
table_name = "user"
email = UnicodeAttribute(null=True)
first_name = UnicodeAttribute(range_key=True)
last_name = UnicodeAttribute(hash_key=True)
Generate marshmallow schemas
============================
.. code-block:: python
from marshmallow_pynamodb import ModelSchema
class UserSchema(ModelSchema):
class Meta:
model = User
user_schema = UserSchema()
(De)serialize your data
=======================
.. code-block:: python
user = User(last_name="Smith", first_name="John")
author_schema.dump(user).data
# {u'first_name': u'John', u'last_name': u'Smith', u'email': None}
author_schema.load({"last_name": "Smith", "first_name": "John"}).data
# user<Smith>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for marshmallow-pynamodb-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9163266a801e2a120ef778b5f3fa0a6ef93f886357a127ab34185e4c636daa5f |
|
MD5 | 491f66844fbef3df771f494dbaaac4f4 |
|
BLAKE2b-256 | 7f06f632805050e47a0e2c74c0fc363edbe67f10f88b50ad66d9a66b2f2617b6 |