Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install sandsnake

How to install sandsnake

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install sandsnake
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
0.1.2 Available View build log
Linux (32-bit)
0.1.2 Available View build log
Linux (64-bit)
0.1.2 Available View build log
 
License
Apache License 2.0
Lastest release
version 0.1.2 on May 11th, 2013
https://secure.travis-ci.org/numan/sandsnake.png?branch=master

Introduction

Sandsnake is a sorted index implemented in python and uses redis as a backend. It was originally implemented to be used as an indexing system for Sunspear.

Requirements

Required

Requirements should be handled by setuptools, but if they are not, you will need the following Python packages:

  • nydus
  • redis
  • dateutil

Optional

  • hiredis
sandsnake.create_sandsnake_backend

Creates an sandsnake object that allows to to store and retrieve indexes:

>>> from sandsnake import create_sandsnake_backend
>>>
>>> sandsnake = create_sandsnake_backend({
>>>     'backend': 'sandsnake.backends.redis.Redis',
>>>     'settings': {
>>>         'defaults': {
>>>             'host': 'localhost',
>>>             'port': 6379,
>>>             'db': 0,
>>>         },
>>>         'hosts': [{'db': 0}, {'db': 1}, {'host': 'redis.example.org'}]
>>>     },
>>> })

Internally, the Redis sandsnake backend uses nydus to distribute your indexes data over your cluster of redis instances.

There are two required arguements:

  • backend: full path to the backend class, which should extend sandsnake.backends.base.BaseSandsnakeBackend
  • settings: settings required to initialize the backend. For the Redis backend, this is a list of hosts in your redis cluster.
Example Usage

Redis

from sandsnake import create_sandsnake_backend
import datetime

sandsnake = create_sandsnake_backend({
    "backend": "sandsnake.backends.redis.Redis",
    "settings": {
        "hosts": [{"db": 5}]
    },
})

#add a value of "abc" to the ``index`` for an ``object``
sandsnake.add("user:1", "homefeed", "abc")
sandsnake.add("user:1", ["homefeed", "recogfeed"], "abc")

Subscribe to package updates

Last updated May 11th, 2013

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.