Maybe it’s obvious, but I realize that you can store a list as value in a TinyDB. So I can use it to store records instead of a relational database as SQLite or similar.
Let’s do some examples.
I have to manage a list of products. I can store in TinyDB each product using product ID as key and a list of properties (for example, category, description, price) as value. When I need these properties I can recover product by ID and then read each value from the list. If I need a list of products, I can iterate each key and than read each value from list.
This is an easy way to emulate a database but there is a limitate way to querying it. We can expand it using another TinyDB storing a property as key and a list of associate IDs as value. For example I can have a record with a category as key and a list of IDs of products that belong to this category.
So if I need all the products of a category I can query the second TinyDB using category as key, read the value as a list of product ID and using that list query the first TinyDB using each item of the list as key.
I must update both TinyDB every time something change so if I remove a product, I must remove its ID from the list of the relative category and so on.
I know, using a real DB it’s the best practice but if you don’t want or if you cannot use other DB or extensions or if you want a really local database, you can use such solution.