Skip to content

A lightweight, encrypted JSON-based database with support for collections, document operations, and aggregation.

License

Notifications You must be signed in to change notification settings

tagoWorks/PyJONDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

PyJONDB

A lightweight, encrypted JSON-based database with support for collections, document operations, and aggregation.

GitHub last commit GitHub issues GitHub license

Discord Website

Python JavaScript Object Notation Database (without script since it sounds better)

This package provides a lightweight, encrypted JSON-based database with support for collections, document operations, and aggregation. It uses the cryptography library for encryption and decryption of data, ensuring secure storage of your sensitive information. The PyPI package includes docstrings for each function to make it easier to learn.

Use pip to download the latest release

pip install pyjondb

Create a user with admin role

# Initialize authentication
auth = session.start()
auth.create_user('admin', 'adminpass', roles=['admin'])

# Authenticate and get a session ID
session_id = auth.authenticate('admin', 'adminpass')
if not session_id:
    raise PermissionError("Authentication failed")

Initialize and create the database

# Initialize the database
# The database function has optional values: 
# pyjondb.database("database", "mypassword", debug=True/False, absolute=True/False)
db = database.init("database", "mydatabasekey", auth)

# Create the database
# Note: you should only create the database if it doesn't already exist
db.create(session_id)

Writing data to the database

# Create a collection
db.create_collection('my_collection', session_id)

# Add a document
db.add_document('my_collection', {'name': 'example'}, session_id)

Read the data

# Get all documents in a collection
print(db.read_collection('my_collection', session_id))

PyJONDB gets way more advanced than writing simple data. To learn more about collections, documents, aggregation, linking, and tree structures read the docs

License & Contact 📃

This project is published under the MIT license

If you are interested in working together, or want to get in contact with me please email me at santiago@tago.works