Name | Json2DbLite JSON |
Version |
1.0.0
JSON |
| download |
home_page | https://github.com/codingtuto/json2db-lite/ |
Summary | A lightweight JSON-based database system inspired by Firestore (Firebase). It's designed for simplicity and ease of use. |
upload_time | 2024-07-26 09:35:29 |
maintainer | None |
docs_url | None |
author | Coding Team |
requires_python | >=3.7 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# json2dblite: Your Go-To Lightweight JSON Database
![illustration](https://telegra.ph/file/374450a4f36c217b3a20b.jpg)
![PyPi downloads](https://img.shields.io/pypi/dm/json2dblite.svg)
![Supported Python versions](https://img.shields.io/pypi/pyversions/json2dblite.svg)
![PyPi Package Version](https://img.shields.io/pypi/v/json2dblite.svg)
## ���� Overview
Hey there! Welcome to **json2dblite**, your friendly, lightweight JSON-based database. Inspired by the simplicity and real-time capabilities of Firestore, json2dblite makes managing your data a breeze. It's packed with features like encryption, backups, and solid error handling���all without the heavy lifting.
## ���� Why Json2dblite?
Let's face it: sometimes you don't need a complex database setup. Maybe you're building a small project, a quick prototype, or you just want a straightforward way to store and retrieve JSON data. json2dblite is here for those moments. It's simple, efficient, and gets the job done without any fuss.
## ���� Features
- **Easy Data Management**: Add, edit, retrieve, and delete data with just a few lines of code.
- **Data Encryption**: Keep your data secure with optional encryption.
- **Backup and Restore**: Automatic backups to keep your data safe.
- **Subcollections**: Organize your data in neat, nested structures.
- **Friendly Error Handling**: Helpful, colorful error messages to guide you.
> json2dblite makes managing JSON data simple and enjoyable. Whether you're building a small app or just need a lightweight data storage solution, json2dblite has you covered. Enjoy!
## ����������� Installation
Getting started is super easy. Just install package via pip and you're good to go:
������
pip install json2dblite
������
## ���� Usage
### ��� Initial Setup
First things first, import the `JsonDB` class and initialize your database:
������
import json2dblite
# Initialize the database with encryption enabled
db = json2dblite.JsonDB(crypted=True)
������
### ���� Basic Operations
#### ��� Setting Data
Adding data is a breeze. Just use the `set_data` method. If the key already exists, you'll get a friendly reminder to use `edit_data` instead.
������
# Set data
db.set_data("users/1", {"name": "Aliou", "age": 20})
db.set_data("users/2", {"name": "Coder", "age": 25})
������
#### ��� Editing Data
Need to update data? No problem. Use the `edit_data` method. It merges the new data with the existing data, so nothing gets lost.
������
# Edit data
db.edit_data("users/1", {"name": "Alex"})
������
#### ���� Getting Data
Retrieving data is as simple as it gets. Use the `get_data` method.
������
# Get data
print(db.get_data("users/1")) # Output: {'name': 'Alex', 'age': 20}
print(db.get_data("users/2")) # Output: {'name': 'Coder', 'age': 25}
������
#### ���� Removing Data
Need to delete something? The `remove_data` method has you covered.
������
# Remove data
db.remove_data("users/2")
������
#### ���� Full Database Retrieval
Want to see everything? Use the `get_db` method. Set `raw=True` if you want the data in a readable format.
������
# Get the full database
print(db.get_db(raw=True))
������
### ���� Working with Subcollections
## ���� Subcollections
In json2dblite, subcollections are a way to organize your data hierarchically. Think of them as nested structures that allow you to group related data together under a parent key. This feature is especially useful when you want to manage complex data relationships without losing the simplicity of JSON.
### ���� What Are Subcollections?
Subcollections are essentially collections within collections. For example, if you have a main collection of users, you might want to organize their posts into separate subcollections. Here���s how you can work with them:
- **Setting Subcollection Data**: Create and populate a subcollection under a specified parent key.
- **Editing Subcollection Data**: Update existing items in a subcollection.
- **Getting Subcollection Data**: Retrieve the data stored within a subcollection.
- **Removing Subcollection Data**: Delete items or entire subcollections.
Using subcollections helps you maintain a clear structure in your data, making it easier to manage and query.
#### ��� Setting Subcollection Data
Organize your data with subcollections. Easy peasy.
������
# Set subcollection data
db.set_subcollection("groups", "1", {"name": "Admins"})
������
#### ��� Editing Subcollection Data
Editing items within a subcollection? No sweat.
������
# Edit subcollection data
db.edit_subcollection("groups", "1", {"description": "Admin group"})
������
#### ���� Getting Subcollection Data
Need to retrieve specific subcollections or items? We've got you.
������
# Get subcollection data
print(db.get_subcollection("groups"))
# Get custom item from the subcollection data
print(db.get_subcollection("groups", "1"))
������
#### ���� Removing Subcollection Data
Removing items from subcollections is just as simple.
������
# Remove subcollection data
db.remove_subcollection("groups", "1")
������
## ���� Error Handling
json2dblite is all about being helpful. Here are some friendly, colorful error messages to guide you:
- **Key Exists**: If you try to set data with an existing key, it will suggest using `edit_data`.
- **Key Not Found**: If a key does not exist when you try to get or remove data, it will notify you with a tip on how to proceed.
- **File Issues**: If there are file permission problems, it will guide you on how to fix them.
## ���� Example Project Structure
Here's how your project might look:
������
project/
���
��������� database/
��� ��������� db.json
��� ��������� db_backup.json
��� ��������� json2dblite.log
��������� your_code.py
������
## Example `main.py`
Let's put it all together with an example `main.py` file:
������
import json2dblite
# Initialize the database with encryption enabled
db = json2dblite.JsonDB(crypted=True)
# Add some initial data
db.set_data("users/1", {"name": "Aliou", "age": 20})
db.set_data("users/2", {"name": "Coder", "age": 25})
# Modify existing data
db.edit_data("users/1", {"name": "Alex"})
# Retrieve and print data
print(db.get_data("users/1"))
print(db.get_data("users/2"))
# Remove data
db.remove_data("users/2")
# Retrieve the full database
print(db.get_db(raw=True))
# Work with subcollections
db.set_subcollection("groups", "1", {"name": "Admins"})
db.edit_subcollection("groups", "1", {"description": "Admin group"})
print(db.get_subcollection("groups"))
db.remove_subcollection("groups", "1")
������
## ���� Contributions and Community
We welcome contributions, suggestions, and feedback to make json2dblite even better! If you have ideas for improvements or want to fix a bug, feel free to:
- **Submit a Pull Request (PR)**: Contribute new features or bug fixes by creating a pull request. Your changes will help improve json2dblite for everyone!
- **Report Issues**: If you encounter any bugs or issues, please open an issue in the repository. Provide as much detail as possible so we can address it swiftly.
- **Suggest Features**: Have an idea for a new feature? Let us know! We���re always open to suggestions on how to enhance json2dblite.
> Your feedback and contributions are greatly appreciated and help us keep json2dblite growing and improving.
## ��� Donations and Support: How You Can Help
Json2DB-Lite is a labor of love, and your support can make a big difference! If you���re enjoying the project and want to show your appreciation, here are a few ways you can help:
### Fork and Star the Repo
One of the best ways to support Json2DB-Lite is to fork the repository and give it a star on GitHub. It���s like a virtual high-five and helps us spread the word about the project. Plus, it shows us that you value the work we���re doing!
### Consider a Donation
If you���re feeling extra generous and want to contribute financially, we���d be incredibly grateful. Donations help us cover costs and keep the project running smoothly. You can support us in the following ways:
- **PayPal**: Send a donation directly to [my PayPal account](https://paypal.me/djibson35). Every little bit helps and is greatly appreciated!
- **Bitcoin**: Prefer cryptocurrency? You can also donate using Bitcoin to the following address: `1Nn15EttfT2dVBisj8bXCnBiXjcqk1ehWR`.
> Your support, whether through a star, a fork, or a donation, helps keep Json2DB-Lite alive and thriving. Thank you for being awesome!
Cheers and happy coding! �������
Raw data
{
"_id": null,
"home_page": "https://github.com/codingtuto/json2db-lite/",
"name": "Json2DbLite",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "Coding Team",
"author_email": "codingteamgroup@gmail.com",
"download_url": null,
"platform": null,
"description": "# json2dblite: Your Go-To Lightweight JSON Database\n![illustration](https://telegra.ph/file/374450a4f36c217b3a20b.jpg)\n![PyPi downloads](https://img.shields.io/pypi/dm/json2dblite.svg) \n![Supported Python versions](https://img.shields.io/pypi/pyversions/json2dblite.svg)\n![PyPi Package Version](https://img.shields.io/pypi/v/json2dblite.svg)\n\n## \ufffd\ufffd\ufffd\ufffd Overview\n\nHey there! Welcome to **json2dblite**, your friendly, lightweight JSON-based database. Inspired by the simplicity and real-time capabilities of Firestore, json2dblite makes managing your data a breeze. It's packed with features like encryption, backups, and solid error handling\ufffd\ufffd\ufffdall without the heavy lifting.\n\n## \ufffd\ufffd\ufffd\ufffd Why Json2dblite?\n\nLet's face it: sometimes you don't need a complex database setup. Maybe you're building a small project, a quick prototype, or you just want a straightforward way to store and retrieve JSON data. json2dblite is here for those moments. It's simple, efficient, and gets the job done without any fuss.\n\n## \ufffd\ufffd\ufffd\ufffd Features\n\n- **Easy Data Management**: Add, edit, retrieve, and delete data with just a few lines of code.\n- **Data Encryption**: Keep your data secure with optional encryption. \n- **Backup and Restore**: Automatic backups to keep your data safe.\n- **Subcollections**: Organize your data in neat, nested structures.\n- **Friendly Error Handling**: Helpful, colorful error messages to guide you.\n\n> json2dblite makes managing JSON data simple and enjoyable. Whether you're building a small app or just need a lightweight data storage solution, json2dblite has you covered. Enjoy! \n\n## \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd Installation\n\nGetting started is super easy. Just install package via pip and you're good to go:\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\npip install json2dblite\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\n## \ufffd\ufffd\ufffd\ufffd Usage\n\n### \ufffd\ufffd\ufffd Initial Setup\n\nFirst things first, import the `JsonDB` class and initialize your database:\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\nimport json2dblite\n\n# Initialize the database with encryption enabled\ndb = json2dblite.JsonDB(crypted=True)\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\n### \ufffd\ufffd\ufffd\ufffd Basic Operations\n\n#### \ufffd\ufffd\ufffd Setting Data\n\nAdding data is a breeze. Just use the `set_data` method. If the key already exists, you'll get a friendly reminder to use `edit_data` instead.\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n# Set data\ndb.set_data(\"users/1\", {\"name\": \"Aliou\", \"age\": 20})\ndb.set_data(\"users/2\", {\"name\": \"Coder\", \"age\": 25})\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\n#### \ufffd\ufffd\ufffd Editing Data\n\nNeed to update data? No problem. Use the `edit_data` method. It merges the new data with the existing data, so nothing gets lost.\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n# Edit data\ndb.edit_data(\"users/1\", {\"name\": \"Alex\"})\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\n#### \ufffd\ufffd\ufffd\ufffd Getting Data\n\nRetrieving data is as simple as it gets. Use the `get_data` method.\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n# Get data\nprint(db.get_data(\"users/1\")) # Output: {'name': 'Alex', 'age': 20}\nprint(db.get_data(\"users/2\")) # Output: {'name': 'Coder', 'age': 25}\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\n#### \ufffd\ufffd\ufffd\ufffd Removing Data\n\nNeed to delete something? The `remove_data` method has you covered.\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n# Remove data\ndb.remove_data(\"users/2\")\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\n#### \ufffd\ufffd\ufffd\ufffd Full Database Retrieval\n\nWant to see everything? Use the `get_db` method. Set `raw=True` if you want the data in a readable format.\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n# Get the full database\nprint(db.get_db(raw=True))\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\n### \ufffd\ufffd\ufffd\ufffd Working with Subcollections\n\n## \ufffd\ufffd\ufffd\ufffd Subcollections\n\nIn json2dblite, subcollections are a way to organize your data hierarchically. Think of them as nested structures that allow you to group related data together under a parent key. This feature is especially useful when you want to manage complex data relationships without losing the simplicity of JSON.\n\n### \ufffd\ufffd\ufffd\ufffd What Are Subcollections?\n\nSubcollections are essentially collections within collections. For example, if you have a main collection of users, you might want to organize their posts into separate subcollections. Here\ufffd\ufffd\ufffds how you can work with them:\n\n- **Setting Subcollection Data**: Create and populate a subcollection under a specified parent key.\n- **Editing Subcollection Data**: Update existing items in a subcollection.\n- **Getting Subcollection Data**: Retrieve the data stored within a subcollection.\n- **Removing Subcollection Data**: Delete items or entire subcollections.\n\nUsing subcollections helps you maintain a clear structure in your data, making it easier to manage and query.\n\n#### \ufffd\ufffd\ufffd Setting Subcollection Data\n\nOrganize your data with subcollections. Easy peasy.\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n# Set subcollection data\ndb.set_subcollection(\"groups\", \"1\", {\"name\": \"Admins\"})\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\n#### \ufffd\ufffd\ufffd Editing Subcollection Data\n\nEditing items within a subcollection? No sweat.\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n# Edit subcollection data\ndb.edit_subcollection(\"groups\", \"1\", {\"description\": \"Admin group\"})\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\n#### \ufffd\ufffd\ufffd\ufffd Getting Subcollection Data\n\nNeed to retrieve specific subcollections or items? We've got you.\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n# Get subcollection data\nprint(db.get_subcollection(\"groups\"))\n\n# Get custom item from the subcollection data\nprint(db.get_subcollection(\"groups\", \"1\"))\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\n#### \ufffd\ufffd\ufffd\ufffd Removing Subcollection Data\n\nRemoving items from subcollections is just as simple.\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n# Remove subcollection data\ndb.remove_subcollection(\"groups\", \"1\")\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\n## \ufffd\ufffd\ufffd\ufffd Error Handling\n\njson2dblite is all about being helpful. Here are some friendly, colorful error messages to guide you:\n\n- **Key Exists**: If you try to set data with an existing key, it will suggest using `edit_data`.\n- **Key Not Found**: If a key does not exist when you try to get or remove data, it will notify you with a tip on how to proceed.\n- **File Issues**: If there are file permission problems, it will guide you on how to fix them.\n\n## \ufffd\ufffd\ufffd\ufffd Example Project Structure\n\nHere's how your project might look:\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\nproject/\n\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd database/\n\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd db.json\n\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd db_backup.json\n\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd json2dblite.log\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd your_code.py\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\n## Example `main.py`\n\nLet's put it all together with an example `main.py` file:\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\nimport json2dblite\n\n# Initialize the database with encryption enabled\ndb = json2dblite.JsonDB(crypted=True)\n\n# Add some initial data\ndb.set_data(\"users/1\", {\"name\": \"Aliou\", \"age\": 20})\ndb.set_data(\"users/2\", {\"name\": \"Coder\", \"age\": 25})\n\n# Modify existing data\ndb.edit_data(\"users/1\", {\"name\": \"Alex\"})\n\n# Retrieve and print data\nprint(db.get_data(\"users/1\"))\nprint(db.get_data(\"users/2\"))\n\n# Remove data\ndb.remove_data(\"users/2\")\n\n# Retrieve the full database\nprint(db.get_db(raw=True))\n\n# Work with subcollections\ndb.set_subcollection(\"groups\", \"1\", {\"name\": \"Admins\"})\ndb.edit_subcollection(\"groups\", \"1\", {\"description\": \"Admin group\"})\nprint(db.get_subcollection(\"groups\"))\ndb.remove_subcollection(\"groups\", \"1\")\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\n## \ufffd\ufffd\ufffd\ufffd Contributions and Community\nWe welcome contributions, suggestions, and feedback to make json2dblite even better! If you have ideas for improvements or want to fix a bug, feel free to:\n\n- **Submit a Pull Request (PR)**: Contribute new features or bug fixes by creating a pull request. Your changes will help improve json2dblite for everyone!\n- **Report Issues**: If you encounter any bugs or issues, please open an issue in the repository. Provide as much detail as possible so we can address it swiftly.\n- **Suggest Features**: Have an idea for a new feature? Let us know! We\ufffd\ufffd\ufffdre always open to suggestions on how to enhance json2dblite.\n\n> Your feedback and contributions are greatly appreciated and help us keep json2dblite growing and improving.\n\n## \ufffd\ufffd\ufffd Donations and Support: How You Can Help\n\nJson2DB-Lite is a labor of love, and your support can make a big difference! If you\ufffd\ufffd\ufffdre enjoying the project and want to show your appreciation, here are a few ways you can help:\n\n### Fork and Star the Repo\n\nOne of the best ways to support Json2DB-Lite is to fork the repository and give it a star on GitHub. It\ufffd\ufffd\ufffds like a virtual high-five and helps us spread the word about the project. Plus, it shows us that you value the work we\ufffd\ufffd\ufffdre doing!\n\n### Consider a Donation\n\nIf you\ufffd\ufffd\ufffdre feeling extra generous and want to contribute financially, we\ufffd\ufffd\ufffdd be incredibly grateful. Donations help us cover costs and keep the project running smoothly. You can support us in the following ways:\n\n- **PayPal**: Send a donation directly to [my PayPal account](https://paypal.me/djibson35). Every little bit helps and is greatly appreciated!\n- **Bitcoin**: Prefer cryptocurrency? You can also donate using Bitcoin to the following address: `1Nn15EttfT2dVBisj8bXCnBiXjcqk1ehWR`.\n\n> Your support, whether through a star, a fork, or a donation, helps keep Json2DB-Lite alive and thriving. Thank you for being awesome!\n\nCheers and happy coding! \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A lightweight JSON-based database system inspired by Firestore (Firebase). It's designed for simplicity and ease of use.",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/codingtuto/json2db-lite/"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6d2252e385021a67727ee8f7c76a773e68659e29a79480d4e106cff1f342094f",
"md5": "7ffa4d4f3e86f05b1891461b139db3b9",
"sha256": "dcf3e348db9b0f3234b7dadf3469ed2d6e1a95086cf86bf758b842069d59554e"
},
"downloads": -1,
"filename": "Json2DbLite-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7ffa4d4f3e86f05b1891461b139db3b9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 8184,
"upload_time": "2024-07-26T09:35:29",
"upload_time_iso_8601": "2024-07-26T09:35:29.262342Z",
"url": "https://files.pythonhosted.org/packages/6d/22/52e385021a67727ee8f7c76a773e68659e29a79480d4e106cff1f342094f/Json2DbLite-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-26 09:35:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "codingtuto",
"github_project": "json2db-lite",
"github_not_found": true,
"lcname": "json2dblite"
}