EasyDB
EasyDB is a simple, category-based key-value database that stores data in plain text files. It's designed to be lightweight and easy to use.
Features
- Simple key-value storage
- Stores data in plain text files
- Supports categories to organize data
Usage
# example.py
from easydb import Database
# Create an instance of the Database class
db = Database("example.db")
# --- Step 1: Store Data ---
# Store some user data under the "USER" category
db.storage("name: Alice", "age: 28", category="USER")
db.storage("admin: True", category="USER")
# Store server and channel data under "CHANNELS" category
db.storage("server_id: 9876", "channel_id: 1234", category="CHANNELS")
# --- Step 2: Load Data ---
# After storing the data, let's load it from the file
db.load()
# --- Step 3: Retrieve Data ---
# Retrieve specific data from the "USER" category
print("User Name:", db.get_data("name", category="USER")) # Alice
print("User Age:", db.get_data("age", category="USER")) # 28
print("Admin:", db.get_data("admin", category="USER")) # True
# Retrieve entire category data (all keys in "USER" category)
print("User Category Data:", db.get_data(category="USER"))
# Output: {'name': 'Alice', 'age': '28', 'admin': 'True'}
# Retrieve specific data from the "CHANNELS" category
print("Server ID:", db.get_data("server_id", category="CHANNELS")) # 9876
print("Channel ID:", db.get_data("channel_id", category="CHANNELS")) # 1234
# Retrieve entire category data (all keys in "CHANNELS" category)
print("Channels Category Data:", db.get_data(category="CHANNELS"))
# Output: {'server_id': '9876', 'channel_id': '1234'}
# --- Step 4: Delete Data ---
# Delete a key from a specific category ("USER" category)
db.del_data("age", category="USER")
print("After Deleting Age from USER:", db.get_data(category="USER"))
# Output: {'name': 'Alice', 'admin': 'True'}
# Delete the entire "USER" category
db.del_data(category="USER")
print("After Deleting USER category:", db.get_data(category="USER"))
# Output: None (since the category was deleted)
# --- Step 5: Store More Data and Delete from Flat Structure ---
# Store data without a category (flat structure)
db.storage("app_name: MyApp")
# Load and retrieve the flat data
db.load()
print("App Name:", db.get_data("app_name")) # MyApp
# Delete the flat data
db.del_data("app_name")
print("After Deleting app_name:", db.get_data("app_name"))
# Output: None (since the key was deleted)
# --- Step 6: Clean-up and Save Changes ---
# The data is automatically saved after each operation (storage and deletion).
# You can manually save it by calling db._save(), but it's not necessary.
Installation
You can install EasyDB via pip:
pip install easydb
Metadata
Release files for easy-db3 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| easy_db3-1.1.0.tar.gz | 4.0 kB | Without provenance | Details for easy_db3-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| easy_db3-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for easy_db3-1.1.0-py3-none-any.whl |
Total release size: 8.2 kB
Release files / easy_db3-1.1.0.tar.gz
| Download URL | easy_db3-1.1.0.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
23dee67eb19dad18ebf53f2de51f7cec2564ec8752fc000291c317db218ecddb
|
|
BLAKE2b-256 checksum How to use checksums |
1117da9a763056bc7cde075c3d5034ec669825da9daa624a84359153caea8812
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.10
|
Release files / easy_db3-1.1.0-py3-none-any.whl
| Download URL | easy_db3-1.1.0-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bc427c4e09b8d0f92b8eed88698885ea5d81e0c80991196f71f41bdee600d67f
|
|
BLAKE2b-256 checksum How to use checksums |
f65c92de44c049d890dc8a287708d81224b4ef7b0b6a9d4b6e939a97380380ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.10
|
Security for easy-db3 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.