Light weight local document-oriented database.
Project description
PetDB
About
PetDB is a simple and lightweight NOSQL JSON database for pet projects. It was designed with the convenient and comfortable API.
Installation
PetDB can be installed with pip:
python -m pip install petdb
You can also download the project source and do:
pip install .
Dependencies
PetDB was created as lightweight package, so there isn't any dependency.
Usage
To use PetDB, first import the PetDB class from the petdb package and create a PetDB instance. By default, it will create folder for storing collections in the current directory, but you can provide any path:
from petdb import PetDB
db = PetDB(os.path.join(os.getcwd(), "persistent", "storage"))
Next you should select or create collection. You can do it just by attribute access, by index key or use a method:
users = db.users
subscriptions = db["subscriptions"]
payments = db.create_collection("payments")
Now you can manage each collection. PetCollection object commits changes on remove, delete, update, insert. There are a lot of methods
Testing
python -m tests.tests
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.