Skip to main content
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")

Release files for sandsnake 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sandsnake 0.1.3
File Size Uploaded
sandsnake-0.1.3.tar.gz 15.0 kB Details

Release files / sandsnake-0.1.3.tar.gz

Download URL sandsnake-0.1.3.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b78698a6efa6ea99d86e83c07292422e46ff41e89da23daa1b861638edc769f5
BLAKE2b-256 checksum
How to use checksums
999034e701e37679ab9c6d0c955058249f47971e8751b4af4ffc1026036f9af2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.3 This release

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page