Need help with python-stdnet?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

121 Stars 19 Forks BSD 3-Clause "New" or "Revised" License 843 Commits 18 Opened issues


Object-data mapper and advanced query manager for non relational databases

Services available


Need anything else?

Contributors list

# 33,236
331 commits
# 269,626
1 commit
# 266,152
1 commit

Object data mapper and advanced query manager for non relational databases.

The data is owned by different, configurable back-end databases and it is accessed using a light-weight Object Data Mapper (ODM). The ODM presents a method of associating user-defined Python classes with database collections, and instances of those classes with items in their corresponding collections. Collections and items are different for different backend databases but are treated in the same way in the python language domain.

:Master CI: |master-build|_ |coverage| :Dev CI: |dev-build|_ |coverage-dev| :Documentation: :Dowloads: :Source: :Platforms: Linux, OS X, Windows. Python 2.6, 2.7, 3.2, 3.3, pypy_ :Mailing List: :Keywords: server, database, redis, odm

.. |master-build| image:: .. _master-build: .. |dev-build| image:: .. _dev-build: .. |coverage| image:: :target: .. |coverage-dev| image:: :target:

Contents ~~~~~~~~~~~~~~~

.. contents:: :local:


  • Models with scalar and multi-value fields.
  • Rich query API including unions, intersections, exclusions, ranges and more.
  • Minimal server round-trips via backend scripting (lua for redis).
  • Full text search.
  • Signals handling to allow decoupled applications to get notified on changes.
  • Synchronous and asynchronous database connection.
  • Multi-variate numeric timeseries application.
  • Asynchronous Publish/Subscribe application.
  • 90% Test coverage.
  • Fully documented.


  • Python 2.6, 2.7, 3.2, 3.3 and pypy_. Single code-base.
  • redis-py_ for redis backend.
  • Optional pulsar_ when using the asynchronous connections or the test suite.
  • You need access to a Redis_ server version 2.6 or above.


Key-valued pairs databases, also know as key-value stores, have many differences from traditional relational databases, most important being they do not use

as their query language, storage does not require a fixed table schemas and usually they do not support complex queries.

Stdnet aims to accommodate a flexible schema and join type operations via a lightweight object data mapper. Importantly, it is designed with large data sets in mind. You pull data you need, nothing more, nothing less. Bandwidth and server round-trips can be reduced to the bare minimum so that your application is fast and memory efficient.


To install, download, uncompress and type::

python install

otherwise use

easy_install python-stdnet


pip install python-stdnet

Version Check

To know which version you have installed::

>>> import stdnet
>>> stdnet.__version__
>>> stdnet.VERSION
stdnet_version(major=0, minor=8, micro=0, releaselevel='final', serial=1)


Backend data-stores are the backbone of the library. Currently the list is limited to

  • Redis_ 2.6 or above.

Object Data Mapper


module is the ODM, it maps python objects into database data and vice-versa. It is design to be fast and safe to use::
from stdnet import odm

class Base(odm.StdModel): '''An abstract model. This won't have any data in the database.''' name = odm.SymbolField(unique = True) ccy = odm.SymbolField()

def __unicode__(self):

class Meta:
    abstract = True

class Instrument(Base): itype = odm.SymbolField()

class Fund(Base): description = odm.CharField()

class PositionDescriptor(odm.StdModel): dt = odm.DateField() size = odm.FloatField() price = odm.FloatField() position = odm.ForeignKey("Position", index=False)

class Position(odm.StdModel): instrument = odm.ForeignKey(Instrument, related_name='positions') fund = odm.ForeignKey(Fund) history = odm.ListField(model=PositionDescriptor)

def __unicode__(self):
    return '%s: %s @ %s' % (,self.instrument,self.dt)

Register models with backend::

models = orm.Router('redis://localhost?db=1')

And play with the API::

>>> f ="pluto, description="The pluto fund", ccy="EUR")
>>> f
Fund: pluto

.. _runningtests:

Running Tests

At the moment, only redis back-end is available and therefore to run tests you need to install Redis. If you are using linux, it can be achieved simply by downloading, uncompressing and running

, if you are using windows you can find sources from MSOpenTech.

Requirements for running tests:

  • python-stdnet
    project directory.
  • pulsar_.

To run tests open a shell and launch Redis. On another shell, from within the

package directory, type::

Tests are run against a local redis server on port

and database 7 by default. To change the server and database where to run tests pass the
option as follow::
python --server redis://

For more information type::

python -h

.. _kudos:


  • Redis_ simply because this library uses its awesome features.
  • SQLAlchemy_ and Django_ for ideas and API design.

.. _contributing:


Development of stdnet happens at Github:

We very much welcome your contribution of course. To do so, simply follow these guidelines:

  1. Fork python-stdnet on github
  2. Create a topic branch
    git checkout -b my_branch
  3. Push to your branch
    git push origin my_branch
  4. Create an issue at with a link to your patch

.. _license:


This software is licensed under the New BSD_ License. See the LICENSE file in the top distribution directory for the full license text.

.. Cython: .. _redis-py: .. _Redis: .. _Mongo: .. _hiredis-py: .. _pymongo: .. _Django: .. _SQLAlchemy: .. _ORM: .. _CouchDB: .. _couchdb-python: .. _Memcached: .. _BSD: .. _Sphinx: .. _coverage: .. _argparse: .. _unittest2: .. _nose: .. _DynamoDB: .. _pulsar: .. _mock: .. _pypy: .. _Mongodb: .. _MSOpenTech:

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.