Skip to content

TinyDB

Installation

Steps taken from this link.

  • Install DuckDB using:
sh
sudo apt install python3-tinydb

Database Setup

  • Create a folder for databases and log into Python shell:
sh
mkdir ~/databases && python
  • Setup a TinyDB database using:
py
from tinydb import TinyDB
db = TinyDB('/home/piratedev/databases/tiny.json')
  • Store and retrieve documents using:
py
db.insert({'type': 'apple', 'count': 7})
db.insert({'type': 'peach', 'count': 3})
db.all()