Skip to main content

Python 2.7/3.x binding for EJDB database engine.

Project description

Embedded JSON database library Python 2.7/3.x binding
============================================================

Installation
---------------------------------

**Required tools/system libraries:**

* gcc
* **Python >= 3.x|2.7.x**
* EJDB C library **libejdb** ([from sources](https://github.com/Softmotions/ejdb#building) or as [debian packages](https://github.com/Softmotions/ejdb#ubuntu))

**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
---------------------------------

```python
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()
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyejdb-1.0.16.tar.gz (27.0 kB view details)

Uploaded Source

File details

Details for the file pyejdb-1.0.16.tar.gz.

File metadata

  • Download URL: pyejdb-1.0.16.tar.gz
  • Upload date:
  • Size: 27.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyejdb-1.0.16.tar.gz
Algorithm Hash digest
SHA256 367dac581124b97aa910a0cfc9992e7be2b89c7a80c2557d35b424ce1e6010a5
MD5 5f5856a21ee5af334ed0cf78f6542089
BLAKE2b-256 7214914f5ac8ef6daf6306dd1323d426ad3f2c8f84deeded84f6d67361749d94

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page