Simple database using btree and json #17990
Replies: 3 comments 10 replies
-
Cool, thanks for sharing! There really is a need for some convenient and high-level on-device storage options for MicroPython. This is an interesting starting point, and might actually be enough for some usecases. It is kind-of a document store, like MongoDB etc. Btw, we have a MessagePack implementation at https://github.com/peterhinch/micropython-msgpack |
Beta Was this translation helpful? Give feedback.
-
Personally, I am interested specifically in time-series data storage. That might benefit from a strategy maybe more around temporal partitioning, more so than using a key-value-store as the base. Maybe Hive-style partitioning. And maybe with .npy files as the contents of partitions, using |
Beta Was this translation helpful? Give feedback.
-
We're starting to have fun here. i added code to allow using the json or umsgpack module. This is controlled by setting USE_JSON to True or False. Don't mix this option on an existing db file, it definitely doesn't work. Curt
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
While testing an sdcard interface I came up with an idea for a database module that allows for table(s) with a primary key and row data.
The btree implementation only allows for a key/value pairs. The key is created by concatenating the table name and primary key. The row data is a dictionary converted to a json string. Lots of limitations but it works.
The module also includes a short demo (test.db) at the end.
Take a look,
Curt
Beta Was this translation helpful? Give feedback.
All reactions