FastJson-db
A lightweight JSON-based database for Python.
fastjson-db allows you to store, retrieve, and manipulate data in a simple JSON file with a minimal and easy-to-use API.
Features
- Lightweight and simple to use
- CRUD operations: insert, get, update, delete
- Automatic unique IDs for records
- Optional fast backend using
orjsonif installed - Human-readable JSON file
Installation
The currently newest version is [0.3.5].
pip install fastjson-db
Examples
Some basic examples on how to user FastJson-db
Creating a Class
To manipulate JsonTables, you need to create a JsonModel subclass (dataclass), so the JsonTable only accepts that especific JsonModel subclass.
from fastjson_db import JsonModel
from dataclasses import dataclass
@dataclass
class User(JsonModel):
_id: int
name: str = ""
password: str = ""
It's obrigatory using _id field or it will not result in error when quering.
Creating a JsonTable
JsonTables are the ones inserting and updating your dataclasses in .json files. They will automaticly create and facilitate the usage of .json "tables", trying to simulate a simple database.
from fastjson_db import JsonModel, JsonTable
from dataclasses import dataclass
@dataclass
class User(JsonModel):
_id: int = 0
name: str = ""
password: str = ""
user = User(name="Allan", password="123")
user_table = JsonTable("users.json", User)
Links
📚 Complete Docs
📝 Changelog
🛣️ Roadmap
🤝 Contributing
Metadata
Release files for fastjson-db 0.3.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastjson_db-0.3.5.tar.gz | 10.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastjson_db-0.3.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.3 kB
Release files / fastjson_db-0.3.5.tar.gz
| Download URL | fastjson_db-0.3.5.tar.gz |
|---|---|
| Size | 10.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37ae8b89b1e8fa5bea029e39d41bcec7ac6da8fa230deca89fe7f49e12d837d1
|
|
BLAKE2b-256 checksum How to use checksums |
99956fcf7f85e2f1051d4d580074f7881f7692182262eaf35a4081130f2ba883
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / fastjson_db-0.3.5-py3-none-any.whl
| Download URL | fastjson_db-0.3.5-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
376ef5122fd72358f8aeaa2193da4a44dd92257a8f5e42cfc5b605b933f7e4ef
|
|
BLAKE2b-256 checksum How to use checksums |
79f8323944b84d0f92a83c45469f8695169f0f4d5671ce2e6d90307b0815b4da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|