Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
A lightweight JSON-based database system inspired by Firestore (Firebase). It's designed for simplicity and ease of use.
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.
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.
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!
Getting started is super easy. Just install package via pip and you're good to go:
������ pip install json2dblite ������
First things first, import the JsonDB
class and initialize your database:
������ import json2dblite
db = json2dblite.JsonDB(crypted=True) ������
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.
������
db.set_data("users/1", {"name": "Aliou", "age": 20}) db.set_data("users/2", {"name": "Coder", "age": 25}) ������
Need to update data? No problem. Use the edit_data
method. It merges the new data with the existing data, so nothing gets lost.
������
db.edit_data("users/1", {"name": "Alex"}) ������
Retrieving data is as simple as it gets. Use the get_data
method.
������
print(db.get_data("users/1")) # Output: {'name': 'Alex', 'age': 20} print(db.get_data("users/2")) # Output: {'name': 'Coder', 'age': 25} ������
Need to delete something? The remove_data
method has you covered.
������
db.remove_data("users/2") ������
Want to see everything? Use the get_db
method. Set raw=True
if you want the data in a readable format.
������
print(db.get_db(raw=True)) ������
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.
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:
Using subcollections helps you maintain a clear structure in your data, making it easier to manage and query.
Organize your data with subcollections. Easy peasy.
������
db.set_subcollection("groups", "1", {"name": "Admins"}) ������
Editing items within a subcollection? No sweat.
������
db.edit_subcollection("groups", "1", {"description": "Admin group"}) ������
Need to retrieve specific subcollections or items? We've got you.
������
print(db.get_subcollection("groups"))
print(db.get_subcollection("groups", "1")) ������
Removing items from subcollections is just as simple.
������
db.remove_subcollection("groups", "1") ������
json2dblite is all about being helpful. Here are some friendly, colorful error messages to guide you:
edit_data
.Here's how your project might look:
������ project/ ��� ��������� database/ ��� ��������� db.json ��� ��������� db_backup.json ��� ��������� json2dblite.log ��������� your_code.py ������
main.py
Let's put it all together with an example main.py
file:
������ import json2dblite
db = json2dblite.JsonDB(crypted=True)
db.set_data("users/1", {"name": "Aliou", "age": 20}) db.set_data("users/2", {"name": "Coder", "age": 25})
db.edit_data("users/1", {"name": "Alex"})
print(db.get_data("users/1")) print(db.get_data("users/2"))
db.remove_data("users/2")
print(db.get_db(raw=True))
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") ������
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:
Your feedback and contributions are greatly appreciated and help us keep json2dblite growing and improving.
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:
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!
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:
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! �������
FAQs
A lightweight JSON-based database system inspired by Firestore (Firebase). It's designed for simplicity and ease of use.
We found that Json2DbLite demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.