This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

simple active record for redis

Project Description

Simple active record for redis. Drop-in replacement for CQLEngine

Why

I needed an active record that worked almost as a drop-in replacement for CQLEngine.

Long-story-short I had a project where I originally wrote the db layer usign cassandra, through CQLEngine. It became an overkill and I decided to use redis instead.

There is a pretty good documentation available and more importantly I commited to 100% of unit and functional test coverage. This code is battle ready for production, if you find any bugs in it you can fix within minutes.

That also means that collaboration is easy, just don’t break anything, don’t delete tests and add as test coverage to you collaboration: when fixing a bug, write at least one test to reproduce the problem in an automated way.

If you want a new feature, please feel free to open a ticket and request, someone might make your dreams come true. Better yet, submit a pull request; just please remember to write tests and documentation for your contributions.

Quick Usage

$ pip install repocket

Declare your models

>>> from repocket import attributes
>>> from repocket import ActiveRecord
>>>
>>>
>>> class User(ActiveRecord):
...     name = attributes.Unicode()
...     house_name = attributes.Unicode()
...     email = attributes.Bytes()
...     password = attributes.Bytes()
...     metadata = attributes.JSON()

Persist in redis

>>> import bcrypt

>>> harry = User(
...     id='970773fa-4de1-11e5-86f4-6c4008a70392',
...     name='Harry Potter',
...     email='harry@hogwards.uk',
...     house_name='Gryffindor',
...     password=bcrypt.hashpw(b'hermione42', bcrypt.gensalt(10)),
...     metadata={
...         'known_tricks': [
...             "Protego",
...             "Expelliarmus",
...             "Wingardium Leviosa",
...             "Expecto Patronum"
...         ]
...     }
... )
>>> redis_keys_for_harry = harry.save()
>>>
>>> ron = User.create(
...     id='40997aa4-71fc-4ad3-b0d7-04c0fac6d6d8',
...     name='Ron Weasley',
...     house_name='Gryffindor',
...     email='ron@hogwards.uk',
...     password=bcrypt.hashpw(b'hermione42', bcrypt.gensalt(10)),
...     metadata={
...         'known_tricks': [
...             "Protego",
...             "Expelliarmus",
...         ]
...     }
... )

Query

>>> harry = User.objects.get(id='970773fa-4de1-11e5-86f4-6c4008a70392')
>>> harry.metadata

>>> results = User.objects.filter(house_name='Griffindor')
>>> len(results)
>>> results[0] == harry
True

>>> results[1] == ron
True
Release History

Release History

This version
History Node

0.1.27

History Node

0.1.26

History Node

0.1.25

History Node

0.1.24

History Node

0.1.23

History Node

0.1.22

History Node

0.1.21

History Node

0.1.20

History Node

0.1.19

History Node

0.1.17

History Node

0.1.16

History Node

0.1.15

History Node

0.1.14

History Node

0.1.13

History Node

0.1.12

History Node

0.1.11

History Node

0.1.10

History Node

0.1.9

History Node

0.1.8

History Node

0.1.7

History Node

0.1.6

History Node

0.1.5

History Node

0.1.4

History Node

0.1.3

History Node

0.1.2

History Node

0.1.1

History Node

0.1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
repocket-0.1.27.tar.gz (16.2 kB) Copy SHA256 Checksum SHA256 Source Jan 19, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting