Skip to main content

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


Download files

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

Source Distribution

petdb-0.2.1.tar.gz (8.5 kB view hashes)

Uploaded Source

Supported by

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