Metadata-Version: 2.0
Name: flywheel
Version: 0.1.2
Summary: SQLAlchemy-style ORM for Amazon's DynamoDB
Home-page: http://flywheel.readthedocs.org/
Author: Steven Arcangeli
Author-email: stevearc@stevearc.com
License: MIT
Keywords: aws dynamo dynamodb orm odm
Platform: any
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Topic :: Database
Requires-Dist: boto (>=2.23.0)

flywheel
========
:Master Build: |build|_ |coverage|_
:0.1 Build: |build-0.1|_ |coverage-0.1|_
:Documentation: http://flywheel.readthedocs.org/
:Downloads: http://pypi.python.org/pypi/flywheel
:Source: https://github.com/mathcamp/flywheel

.. |build| image:: https://travis-ci.org/mathcamp/flywheel.png?branch=master
.. _build: https://travis-ci.org/mathcamp/flywheel
.. |coverage| image:: https://coveralls.io/repos/mathcamp/flywheel/badge.png?branch=master
.. _coverage: https://coveralls.io/r/mathcamp/flywheel?branch=master

.. |build-0.1| image:: https://travis-ci.org/mathcamp/flywheel.png?branch=0.1
.. _build-0.1: https://travis-ci.org/mathcamp/flywheel
.. |coverage-0.1| image:: https://coveralls.io/repos/mathcamp/flywheel/badge.png?branch=0.1
.. _coverage-0.1: https://coveralls.io/r/mathcamp/flywheel?branch=0.1

Object mapper for Amazon's DynamoDB

Getting Started
===============
This is what a basic model looks like (schema taken from this `DynamoDB
API documentation
<http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.html>`_)
::

    from flywheel import Model, Field, GlobalIndex

    class GameScore(Model):
        __metadata__ = {
            'global_indexes': [
                GlobalIndex('GameTitleIndex', 'title', 'top_score')
            ],
        }
        userid = Field(hash_key=True)
        title = Field(range_key=True)
        top_score = Field(data_type=int)
        top_score_time = Field(data_type=datetime)
        wins = Field(data_type=int)
        losses = Field(data_type=int)

        def __init__(self, title, userid):
            self.title = title
            self.userid = userid

Create a new top score::

    >>> score = GameScore('Master Blaster', 'abc')
    >>> score.top_score = 9001
    >>> score.top_score_time = datetime.utcnow()
    >>> engine.sync(score)

Get all top scores for a user::

    >>> scores = engine.query(GameScore).filter(userid='abc').all()

Get the top score for Galaxy Invaders::

    >>> top_score = engine.query(GameScore).filter(title='Galaxy Invaders')\
    ...     .first(desc=True)

Atomically increment a user's "wins" count on Alien Adventure::

    >>> score = GameScore('Alien Adventure', 'abc')
    >>> score.incr_(wins=1)
    >>> engine.sync(score)

Get all scores on Comet Quest that are over 9000::

    >>> scores = engine.query(GameScore).filter(GameScore.top_score > 9000,
    ...                                         title='Comet Quest').all()


Changelog
=========

0.1.2
-----
* Bug fix: Field names can begin with an underscore 
* Feature: Models have a nice default __init__ method 

0.1.1
-----
* Bug fix: Can call ``incr_()`` on models that have not been saved yet 
* Bug fix: Model comparison with ``None`` 

0.1.0
-----
* First public release


