fiableDB/README.md

97 lines
2.4 KiB
Markdown
Raw Normal View History

2022-11-08 07:18:14 +01:00
Immutable NoSQL database that works on a single plain text file
2022-11-08 07:14:29 +01:00
## Features
2022-11-08 22:14:27 +01:00
- **Information is never lost**. Even if you make updates or deletions, you will be able to recover any information at any time.
- There are **no restrictions on the data structure or columns**, since dictionaries are used without limitations on nesting. Similar to MongoDB Documents.
- All the information is **stored in a JSON file**.
- Extremely fastb since it has no queue or locking limitations.
- **Minimalistic** to implement and use.
2022-11-08 07:14:29 +01:00
## Advantages of using an immutable database
2022-11-08 07:18:14 +01:00
2022-11-08 22:14:27 +01:00
- **High level of consistency and accuracy of data**, such as a hospital patient's chronology or banking data. It cannot be modified once it has been aggregated.
- They **simplify the process of backing up and restoring data**, because you can always **revert to the original version** of the data if necessary.
- **Very secure**, modifying existing data will be detected and rejected.
2022-11-08 07:18:14 +01:00
## Install
2022-11-08 22:14:27 +01:00
```python
pip3 install --user advance-touch
```
2022-11-08 22:49:43 +01:00
## Documentation
All documentation can be read as a sequential tutorial.
### Start
```python
import fiable_db
db = fiable_db.start()
```
2022-11-08 07:18:14 +01:00
### Agregation
2022-11-08 22:49:43 +01:00
Only one:
```python
db.add({"name": "Noelia", "age": 34, "height": 165})
// {"id": 1, "rev": 1, "data": {"name": "Miguel", "age": 54, "height": 155}}
```
Various:
```python
db.add(
[
{"name": "Noelia", "age": 34, "height": 165},
{"name": "Juan", "age": 41, "height": 187},
{"name": "Valentina", "age": 12, "height": 142},
]
)
// [
// {"id": 2, "rev": 1, "data": {{"name": "Noelia", "age": 34, "height": 165}},
// {"id": 3, "rev": 1, "data": {{"name": "Juan", "age": 41, "height": 187}},
// {"id": 4, "rev": 1, "data": {{"name": "Valentina", "age": 83, "height": 172}},
// ]
```
2022-11-08 07:18:14 +01:00
### Update
2022-11-08 22:49:43 +01:00
Update a key:
```python
db.update(4, {"age": 21})
// {"id": 4, "rev": 2, "data": {{"name": "Valentina", "age": 21, "height": 172}}
```
Add new key:
```python
db.update(4, {"is_active": True})
// {"id": 4, "rev": 3, "data": {{"name": "Valentina", "age": 21, "height": 172, "is_active": True}}
```
Delete key:
```python
db.update(4, {"height": None})
// {"id": 4, "rev": 4, "data": {{"name": "Valentina", "age": 21, "is_active": True}}
```
Forcing new structure.
```python
db.update(4, {"name": "Javier", "email": "foo@example.com"}, force=True)
// {"id": 4, "rev": 5, "data": {{"name": "Javier", "email": "foo@example.com"}}
```
2022-11-08 07:18:14 +01:00
### Delete
### Find all
### Find one
2022-11-08 22:14:27 +01:00