EJDB Python binding
Python C Makefile
Permalink
Failed to load latest commit information.
debian EJDB 1.2.3 migration Mar 20, 2015
pyejdb Merge pull request #5 from inlanger/docs-typo-fix Mar 20, 2015
samples #47 Feb 15, 2013
src EJDB v1.2.3 migrarion Mar 20, 2015
test EJDB v1.2.3 migrarion Mar 20, 2015
.gitignore EJDB v1.2.3 migrarion Mar 20, 2015
LICENSE Added LGPL licence file Sep 12, 2013
MANIFEST.in python docs Feb 15, 2013
Makefile Makefile Sep 12, 2013
README.md EJDB v1.2.3 migrarion Mar 20, 2015
distribute_setup.py python docs Feb 15, 2013
pyejdb.iml build automation Aug 19, 2013
setup.py #6 fixed Mar 20, 2015

README.md

Embedded JSON database library Python 2.7/3.x binding

Installation

Required tools/system libraries:

Python binding published: http://pypi.python.org/pypi/pyejdb

(A) Installing using pip

pip for python3 or python2 should be installed (sudo apt-get install python3-pip | sudo apt-get install python-pip)

umask 022

   sudo pip install pyejdb

Upgrading:
   sudo pip install pyejdb --upgrade

(B) Installing directly from sources

umask 022

git clone https://github.com/Softmotions/ejdb-python.git
cd ./ejdb-python
sudo python3 ./setup.py install

(C) Installing on Ubuntu/Debian (only for Python3.x)

sudo add-apt-repository ppa:adamansky/ejdb
sudo apt-get update
sudo apt-get install python3-ejdb

One snippet intro

import pyejdb
from datetime import datetime

#Open database
ejdb = pyejdb.EJDB("zoo", pyejdb.DEFAULT_OPEN_MODE | pyejdb.JBOTRUNC)

parrot1 = {
    "name": "Grenny",
    "type": "African Grey",
    "male": True,
    "age": 1,
    "birthdate": datetime.utcnow(),
    "likes": ["green color", "night", "toys"],
    "extra1": None
}
parrot2 = {
    "name": "Bounty",
    "type": "Cockatoo",
    "male": False,
    "age": 15,
    "birthdate": datetime.utcnow(),
    "likes": ["sugar cane"],
    "extra1": None
}
ejdb.save("parrots2", parrot1, parrot2)

with ejdb.find("parrots2", {"likes" : "toys"},
          hints={"$orderby" : [("name", 1)]}) as cur:
    print("found %s parrots" % len(cur))
    for p in cur:
        print("%s likes toys!" % p["name"])

ejdb.close()