Moving beyond a single flat file
For more complex projects, a flat-file database may not be the way to go. Here is one example of how you could store data in a more distributed way:
- db folder
- users
- user1.pyn
- user2.pyn
- etc
- transactions
- 001.pyn
- 002.pyn
- etc
- config.json
- users
Python implementation:
from pyntree import Node
config = Node('db/config.json')
# On request with argument "transaction_id"
data = Node(f'db/transactions/{transaction_id}')
return data()
No Comments