| Name | tinyjsondb JSON |
| Version |
0.1.3
JSON |
| download |
| home_page | None |
| Summary | A lightweight, JSON-based Python ORM library |
| upload_time | 2025-08-12 16:16:19 |
| maintainer | None |
| docs_url | None |
| author | Waland2 |
| requires_python | >=3.10 |
| license | None |
| keywords |
json
database
orm
tinydb
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# tinyjsondb
tinyjsondb is a minimal Python ORM for working with JSON files as a simple database.
It allows defining models with typed fields, creating, reading, updating, and deleting records, all stored in JSON.
## Installation
```bash
pip install tinyjsondb
```
or from source:
```bash
git clone https://github.com/Waland2/tinyjsondb.git
cd tinyjsondb
pip install .
```
## Quick Start
```python
from tinyjsondb import Model, IntegerField, StringField, ListField
class User(Model):
name = StringField(default="Anonymous")
hobbies = ListField(default=[])
# Initialize the storage file and sync schema
User.sync()
# Create a record
User.objects.create(name="Alice", hobbies=["reading"])
# Get a record
user = User.objects.get(id=1)
print(user.name) # Alice
# Update a record
user.update(name="Alice Wonderland")
# Delete a record
user.delete()
user = User.objects.get(id=1)
print(user is None) # True
# Get all records
users = User.objects.all()
```
## Overview
**Model methods:**
* `sync()` - create or update the JSON file with data.
* `save()` - insert or update the record.
* `update(**kwargs)` - update fields and save.
* `delete()` - remove the record.
* `pk()` - return the primary key value.
**Manager methods (`Model.objects`):**
* `create(**kwargs)` - insert a new record.
* `get(**kwargs)` - return the first matching record or `None`.
* `get_or_create(**kwargs)` - return an existing record or create it.
* `all()` - return all records.
* `update(obj)` - update an existing record.
* `delete(**kwargs)` - remove a record by field values.
* `clear()` - remove all records.
### Field types
* `IntegerField()` - integer field.
* `StringField()` - string field.
* `ListField()` - list field.
* `DictField()` - dictionary field.
## License
This project is licensed under the [MIT License](LICENSE.md).
Raw data
{
"_id": null,
"home_page": null,
"name": "tinyjsondb",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "json, database, orm, tinydb",
"author": "Waland2",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/e5/ef/10bbcd5974e56f3fb3adc1fa0a0aeb6c2eb091784d87f65a92c0a3fd60ed/tinyjsondb-0.1.3.tar.gz",
"platform": null,
"description": "# tinyjsondb\n\ntinyjsondb is a minimal Python ORM for working with JSON files as a simple database.\nIt allows defining models with typed fields, creating, reading, updating, and deleting records, all stored in JSON.\n\n## Installation\n\n```bash\npip install tinyjsondb\n```\n\nor from source:\n\n```bash\ngit clone https://github.com/Waland2/tinyjsondb.git\ncd tinyjsondb\npip install .\n```\n\n## Quick Start\n\n```python\nfrom tinyjsondb import Model, IntegerField, StringField, ListField\n\nclass User(Model):\n name = StringField(default=\"Anonymous\")\n hobbies = ListField(default=[])\n\n# Initialize the storage file and sync schema\nUser.sync()\n\n# Create a record\nUser.objects.create(name=\"Alice\", hobbies=[\"reading\"])\n\n# Get a record\nuser = User.objects.get(id=1)\nprint(user.name) # Alice\n\n# Update a record\nuser.update(name=\"Alice Wonderland\")\n\n# Delete a record\nuser.delete()\nuser = User.objects.get(id=1)\nprint(user is None) # True\n\n# Get all records\nusers = User.objects.all()\n```\n\n## Overview\n\n**Model methods:**\n\n* `sync()` - create or update the JSON file with data.\n* `save()` - insert or update the record.\n* `update(**kwargs)` - update fields and save.\n* `delete()` - remove the record.\n* `pk()` - return the primary key value.\n\n**Manager methods (`Model.objects`):**\n\n* `create(**kwargs)` - insert a new record.\n* `get(**kwargs)` - return the first matching record or `None`.\n* `get_or_create(**kwargs)` - return an existing record or create it.\n* `all()` - return all records.\n* `update(obj)` - update an existing record.\n* `delete(**kwargs)` - remove a record by field values.\n* `clear()` - remove all records.\n\n### Field types\n\n* `IntegerField()` - integer field.\n* `StringField()` - string field.\n* `ListField()` - list field.\n* `DictField()` - dictionary field.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE.md).\n\n\n\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A lightweight, JSON-based Python ORM library",
"version": "0.1.3",
"project_urls": {
"Repository": "https://github.com/Waland2/tinyjsondb"
},
"split_keywords": [
"json",
" database",
" orm",
" tinydb"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "8dc3ab4d7ff46fcf827a9bcbb3dc7bf89d9ba3f284ee46f2f311b6bf2ec7d1b1",
"md5": "c430b4f4f52975b23d3e675533212e55",
"sha256": "17761f7148bbe51a7eeeef0c9f5c227073017b83cd041f0e7b643594cb9e4ef5"
},
"downloads": -1,
"filename": "tinyjsondb-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c430b4f4f52975b23d3e675533212e55",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 6188,
"upload_time": "2025-08-12T16:16:18",
"upload_time_iso_8601": "2025-08-12T16:16:18.963448Z",
"url": "https://files.pythonhosted.org/packages/8d/c3/ab4d7ff46fcf827a9bcbb3dc7bf89d9ba3f284ee46f2f311b6bf2ec7d1b1/tinyjsondb-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e5ef10bbcd5974e56f3fb3adc1fa0a0aeb6c2eb091784d87f65a92c0a3fd60ed",
"md5": "b90a69e4d5f0d085c003f98ffb72c694",
"sha256": "a101962c3344253be954817ddab633ab4c5d705abf06a977a1d6595c657b1ef7"
},
"downloads": -1,
"filename": "tinyjsondb-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "b90a69e4d5f0d085c003f98ffb72c694",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 6949,
"upload_time": "2025-08-12T16:16:19",
"upload_time_iso_8601": "2025-08-12T16:16:19.927761Z",
"url": "https://files.pythonhosted.org/packages/e5/ef/10bbcd5974e56f3fb3adc1fa0a0aeb6c2eb091784d87f65a92c0a3fd60ed/tinyjsondb-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-12 16:16:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Waland2",
"github_project": "tinyjsondb",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "tinyjsondb"
}