Immutable NoSQL database in a plain file
Go to file
Andros Fenollosa 57a13124bb Update docs
2022-11-08 22:49:43 +01:00
README.md Update docs 2022-11-08 22:49:43 +01:00

Immutable NoSQL database that works on a single plain text file

Features

  • 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.

Advantages of using an immutable database

  • 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.

Install

pip3 install --user advance-touch

Documentation

All documentation can be read as a sequential tutorial.

Start

import fiable_db

db = fiable_db.start()

Agregation

Only one:

db.add({"name": "Noelia", "age": 34, "height": 165})
// {"id": 1, "rev": 1, "data": {"name": "Miguel", "age": 54, "height": 155}}

Various:

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}},
//  ]

Update

Update a key:

db.update(4, {"age": 21})
// {"id": 4, "rev": 2, "data": {{"name": "Valentina", "age": 21, "height": 172}}

Add new key:

db.update(4, {"is_active": True})
// {"id": 4, "rev": 3, "data": {{"name": "Valentina", "age": 21, "height": 172, "is_active": True}}

Delete key:

db.update(4, {"height": None})
// {"id": 4, "rev": 4, "data": {{"name": "Valentina", "age": 21, "is_active": True}}

Forcing new structure.

db.update(4, {"name": "Javier", "email": "foo@example.com"}, force=True)
// {"id": 4, "rev": 5, "data": {{"name": "Javier", "email": "foo@example.com"}}

Delete

Find all

Find one