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

Overview

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: http://pythonhosted.org/python-stdnet/
Dowloads: http://pypi.python.org/pypi/python-stdnet/
Source: https://github.com/lsbardel/python-stdnet
Platforms: Linux, OS X, Windows. Python 2.6, 2.7, 3.2, 3.3, pypy
Mailing List: https://groups.google.com/group/python-stdnet
Keywords: server, database, redis, odm

Contents

Features

  • 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.

Requirements

  • 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.

Philosophy

Key-valued pairs databases, also know as key-value stores, have many differences from traditional relational databases, most important being they do not use SQL 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.

Installing

To install, download, uncompress and type:

python setup.py install

otherwise use easy_install:

easy_install python-stdnet

or pip:

pip install python-stdnet

Version Check

To know which version you have installed:

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

Backends

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

Object Data Mapper

The stdnet.odm 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):
        return self.name

    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.fund,self.instrument,self.dt)

Register models with backend:

models = orm.Router('redis://localhost?db=1')
models.register(Instrument)
models.register(Fund)
models.register(PositionDescriptor,'redis://localhost?db=2')
models.register(Position,'redis://localhost?db=2')

And play with the API:

>>> f = models.fund.new(name="pluto, description="The pluto fund", ccy="EUR")
>>> f
Fund: pluto

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 make, 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 python-stdnet package directory, type:

python runtests.py

Tests are run against a local redis server on port 6379 and database 7 by default. To change the server and database where to run tests pass the --server option as follow:

python runtests.py --server redis://myserver.com:6450?db=12&password=bla

For more information type:

python runtests.py -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: http://github.com/lsbardel/python-stdnet

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 https://github.com/lsbardel/python-stdnet/issues 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.

Owner
Luca Sbardella
quantitative wizard at @quantmind
Luca Sbardella
This tool don't used illegal ativity

ETHICALTOOL This tool for only educational purposes don't used illegal ativity @onlinehacking this tool for pkg update && pkg upgrade && pkg install g

Mrkarthick 4 Dec 23, 2021
A program that takes Python classes and turns them into CSS classes.

PyCSS What is it? PyCSS is a micro-framework to speed up the process of writing bulk CSS classes. How does it do it? With Python!!! First download the

T.R Batt 0 Aug 03, 2021
Snack Rice - A Rice University servery finder, customized for your needs!

Snack Rice - A Rice University servery finder, customized for your needs!

Aidan Gerber 3 Sep 25, 2022
Convert three types of color in your clipboard and paste it to the color property (gamma correct)

ColorPaster [Blender Addon] Convert three types of color in your clipboard and paste it to the color property (gamma correct) How to Use Hover your mo

13 Oct 31, 2022
A webdav demo using a virtual filesystem that serves a random status of whether a cat in a box is dead or alive.

A webdav demo using a virtual filesystem that serves a random status of whether a cat in a box is dead or alive.

Marshall Conover 2 Jan 12, 2022
Hopefully the the next-generation backend server of bgm.tv

Hopefully the the next-generation backend server of bgm.tv

Bangumi 475 Jan 01, 2023
MODSKIN-LOLPRO-updater: The mod is fkn 10y old and has'nt a self-updater

The mod is fkn 10y old and has'nt a self-updater. To use it just run the exec, wait some seconds, and it will run the new modsk

Shiro Amurha 3 Apr 23, 2022
Export transactions for an algorand wallet to a CSV file

algorand_txn_csv_exporter - (Algorand transaction CSV exporter) This script will export transactions for an algorand wallet to a CSV file. It is inten

TeneoPython01 5 Jun 19, 2022
Collection of tools to be more productive in your work environment and to avoid certain repetitive tasks. 💛💙💚

Collection of tools to be more productive in your work environment and to avoid certain repetitive tasks. 💛💙💚

Raja Rakotonirina 2 Jan 10, 2022
Python script for converting obsidian md-file to html (recursively adds all link/images)

ObsidianToHtmlConverter I made a small python script for converting obsidian md-file to static (local) html (recursively adds all link/images) I made

47 Jan 03, 2023
A pypi package details search python module

A pypi package details search python module

Fayas Noushad 5 Nov 30, 2021
Protocol Buffers for the Rest of Us

Protocol Buffers for the Rest of Us Motivation protoletariat has one goal: fixing the broken imports for the Python code generated by protoc. Usage He

Phillip Cloud 76 Jan 04, 2023
Flask html response minifier

Flask-HTMLmin Minify flask text/html mime type responses. Just add MINIFY_HTML = True to your deployment config to minify HTML and text responses of y

Hamid Feizabadi 85 Dec 07, 2022
Expense-manager - Expense manager with python

Expense_manager TO-DO Source extractor: Credit Card, Wallet Destination extracto

1 Feb 13, 2022
Chalice - A tool to facilitate Python based lambda deployment

Chalice is a tool to facilitate Python based lambda deployment. This repo contains the output of my basic exploration of this tool.

Csilla Bessenyei 1 Feb 03, 2022
tagls is a language server based on gtags.

tagls tagls is a language server based on gtags. Why I wrote it? Almost all modern editors have great support to LSP, but language servers based on se

daquexian 31 Dec 01, 2022
Sudoku solver using backtracking

Sudoku solver Sudoku solver using backtracking Basically in sudoku, we want to be able to solve a sudoku puzzle given an input like this, which repres

Kylie 99 Jan 07, 2023
Procedural modeling of fruit and sandstorm in Blender (bpy).

SandFruit Procedural modelling of fruit and sandstorm. Created by Adriana Arcia and Maya Boateng. Last updated December 19, 2020 Goal & Inspiration Ou

Adriana Arcia 2 Mar 20, 2022
Taking the fight to the establishment.

Throwdown Taking the fight to the establishment. Wat? I wanted a simple markdown interpreter in python and/or javascript to output html for my website

Trevor van Hoof 1 Feb 01, 2022
Hacking and Learning consistently for 100 days straight af.

#100DaysOfHacking Hacking and Learning consistently for 100 days straight af. [yes, no breaks except mental-break ones, Obviously.] This Repo is one s

FENIL SHAH 17 Sep 09, 2022