https://github.com/divad1196/rundb
Pseudo NoSQL Database. It is meant to help using configuration that could be edited by hand and gited
https://github.com/divad1196/rundb
database easy easy-to-use file filesystem json nosql python python3 readable tinydb
Last synced: 4 months ago
JSON representation
Pseudo NoSQL Database. It is meant to help using configuration that could be edited by hand and gited
- Host: GitHub
- URL: https://github.com/divad1196/rundb
- Owner: divad1196
- License: agpl-3.0
- Created: 2020-08-01T18:30:56.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-10T19:46:24.000Z (over 5 years ago)
- Last Synced: 2025-09-29T12:26:53.512Z (6 months ago)
- Topics: database, easy, easy-to-use, file, filesystem, json, nosql, python, python3, readable, tinydb
- Language: Python
- Homepage:
- Size: 29.3 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RunDB
RunDb is not exactly a database.
It is similar to [TinyDB](https://tinydb.readthedocs.io/en/stable/) on storing files as json.
The main point of this library is to help the user on storing and loading data.
## Installation
[Pypi Package](https://pypi.org/project/rundb/)
```bash
pip3 install rundb
```
## Philosophy
* NoSql with tools to simulate relational
* Table are all fully loaded when declared
* Query are done using python
* Data are dict, they all have a unique key as a string
### Quick Overview
```python
import RunDB
from pathlib import Path
from RunDB.tools.serialization import call_kwargs
# Path to DB folder
db_path = Path("testRunDB")
# Create the Database instance
db = RunDB.Database(db_path)
# Get or Create User table, specifying the key as login (default is "id")
# The key is used to find, if not explicitly given, the database id
User = db.table("user", key="login")
# Same for Group table
Group = db.table(
"group",
key="name",
one2many={"users": "user"}
)
# Create User 1
u1 = User.append({"login": "paul"}) # With values
# without values,
u2 = User["Matthieu"]
u3 = User["Thomas"]
u1.age = 18
u2.age = 20
u3.age = 18
res = User.filter(lambda user: user.age == 20)
list(User.records())
test= Group["test"]
test.users.append(u1)
adminGroup = Group.append({
"name": "admin", # as the table key is "name", name will be poped
})
db["test"]["new"] = {"name": "new data"} # Quick insert
# Check if record has attribute age
"age" in u1 # True
# Get a dict
data = dict(u1.items())
db.dump_all()
```
Nb: Database are simply Group of Table, We can register Tables from somewhere else or simply use a Table without Database object
## Future
* improve relational