Documentation for pulsar 0.9.2. For development docs, go here.

Available Clients

Redis

Pulsar is shipped with a Store implementation for redis and pulsard-ds servers.

Redis Store

class pulsar.apps.data.stores.redis.store.RedisStore(name, host, loop=None, database=None, user=None, password=None, encoding=None, **kw)[source]

Redis Store implementation.

namespace

The prefix namespace to append to all transaction on keys

client()[source]

Get a RedisClient for the Store

pipeline()[source]

Get a Pipeline for the Store

execute_transaction(transaction)[source]

Execute a Transaction

close()[source]

Close all open connections.

meta(meta)[source]

Extract model metadata for lua script stdnet/lib/lua/odm.lua

Redis Client

class pulsar.apps.data.stores.redis.client.RedisClient(store)[source]

Client for RedisStore.

store

The RedisStore for this client.

pipeline()[source]

Create a Pipeline for pipelining commands

zadd(name, *args, **kwargs)[source]

Set any number of score, element-name pairs to the key name. Pairs can be specified in two ways:

As *args, in the form of:

score1, name1, score2, name2, ...

or as **kwargs, in the form of:

name1=score1, name2=score2, ...

The following example would add four values to the ‘my-key’ key:

client.zadd('my-key', 1.1, 'name1', 2.2, 'name2',
            name3=3.3, name4=4.4)
sort(key, start=None, num=None, by=None, get=None, desc=False, alpha=False, store=None, groups=False)[source]

Sort and return the list, set or sorted set at key.

start and num allow for paging through the sorted data

by allows using an external key to weight and sort the items.
Use an “*” to indicate where in the key the item value is located
get allows for returning items from external keys rather than the
sorted data itself. Use an “*” to indicate where int he key the item value is located

desc allows for reversing the sort

alpha allows for sorting lexicographically rather than numerically

store allows for storing the result of the sort into
the key store
groups if set to True and if get contains at least two
elements, sort will return a list of tuples, each containing the values fetched from the arguments to get.

Redis Pipeline

class pulsar.apps.data.stores.redis.client.Pipeline(store)[source]

A RedisClient for pipelining commands

commit(raise_on_error=True)[source]

Send commands to redis.

PulsarDs

It has the same implementation as redis client.

CouchDb

CouchDB document store:

store = create_store('http+couchdb://localhost:5984/mydb')

Models

A Model is stored as a document in the store database, this means instances of different models which use the same couchdb store are stored in exactly the same database.

To differentiate and query over different types of models, the Type field is added to the document representing a model.

Queries

CouchDBStore

class pulsar.apps.data.stores.couchdb.store.CouchDBStore(name, host, loop=None, database=None, user=None, password=None, encoding=None, **kw)[source]
info()[source]

Information about the running server

ping()

Information about the running server

create_database(dbname=None, **kw)[source]

Create a new database

Parameters:dbname – optional database name. If not provided the _database is created instead.
delete_database(dbname=None)[source]

Delete a database dbname

all_databases()[source]

The list of all databases

design_create(name, views, language=None, **kwargs)[source]

Create a new design document

design_delete(*args, **kwargs)[source]

Delete an existing design document at name.

get_document(dbname, pkvalue)[source]

Fetch a document from dbname with id pkvalue

update_documents(dbname, documents, new_edits=True)[source]

Bulk update/insert of documents in a database

drop_table(model)[source]

Drop model table by simply removing model design views

execute_transaction(transaction)[source]

Execute a transaction

query_model_view(model, view_name, key=None, keys=None, group=None, limit=None, include_docs=None, reduce=True, method=None)[source]

Query an existing view

All view parameters here:

http://wiki.apache.org/couchdb/HTTP_view_API

request(*args, **kwargs)[source]

Execute the HTTP request

model_data(model, action)[source]

A generator of field/value pair for the store



Table Of Contents

Previous topic

Object Data Mapper

This Page