A small database using json
Project description
PyDbJson
pydbjson
is a simple Python library for managing JSON-based databases.
Table of Contents
Installation
You can install pydbjson
using pip:
pip install pydbjson
Description
pydbjson
provides a convenient way to interact with JSON-based databases in Python. It allows you to load data from a JSON file, insert, retrieve, delete, and find documents, and save the data back to the file.
Usage
Importing the library
from pydbjson.pydbjson import pydbjson
Creating an instance of pydbjson
db = pydbjson("database.json")
Create an instance of the pydbjson
class by providing the filename or path of the JSON database file.
Inserting a document
document = {"name": "John", "age": 30}
key = db.insert_one(document)
Insert a document into the database. The insert_one
method returns the key of the inserted document.
Find a document
document = {"name": "John"}
found_document = db.find_one(document)
Find a document from the database based on the provided data.
Deleting a document
db.delete_one(found_document)
Delete a document from the database based on the data.
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
File details
Details for the file pydbjson-0.0.5.tar.gz
.
File metadata
- Download URL: pydbjson-0.0.5.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca225a2447dd453a7c3e6cd63b67931a1a6f72240679449b9cb60a2539294ad7 |
|
MD5 | 85b780e97252368ba3f7b6e84cdd07cc |
|
BLAKE2b-256 | f6b117f0e80c5b04fbc6e0f32f2e5e222da9162d3805ae14398f8d4f0758732c |