Page 2 of 3

Re: 2nd ESP8266 projects stretch goal - Embedded Database (btree module)

Posted: Sun Apr 09, 2017 8:44 pm
by pfalcon
SpotlightKid wrote:One remark about the docs: I don't see any mention of what the implicit sort order of keys is. If it is alphabetical, which I assume, which encoding is used and is it by code point or lexicographical?
Keys are Python bytes objects and sorted like Python bytes objects (which use lexicographic sorting).
Can the sort method be changed?
It will be interesting to revisit this question when we have a lot of software leveraging the current capabilities of the module. I'm personally waiting for a killer app (say, 1000 github stars).
Apart from that the docs have the (usual ;-)) inconsistent use of single and double backticks, which is all over the docs. I admit, it's easy to get this wrong, especially when one often writes Markdown at other times.
Patches welcome.

Re: 2nd ESP8266 projects stretch goal - Embedded Database (btree module)

Posted: Sat May 13, 2017 11:13 pm
by pfalcon
I'm happy to report that "Notes Pico" web application, which is the reference test application for MicroPython's Picoweb web framework, has been finally ported to use btree database backend. The latest version wasn't yet released to PyPI, waiting for last-minute fixes, but is available at https://github.com/pfalcon/notes-pico .

Note that it still remains tested only with Unix version of MicroPython, but yes, the idea is to keep porting and optimizing it to be able to run on ESP8266 (which will guaranteedly require freezing it as bytecode).

Re: 2nd ESP8266 projects stretch goal - Embedded Database (btree module)

Posted: Sun May 14, 2017 10:03 pm
by pfalcon
The latest version of Notes Pico published to PyPI: https://pypi.python.org/pypi/notes-pico/

Re: 2nd ESP8266 projects stretch goal - Embedded Database (btree module)

Posted: Sun Aug 06, 2017 1:02 pm
by crizeo
I wanted to use the btree module to map ~500000 words to integers. Therefore I would have to transform the dict (that I have on my Windows/Linux machine saved via pickle and in standard text file) into a btree.

Is there any possible way to transform the dict to btree on Windows/Linux (and then send the btree database file to the esp8266 via ampy)?
Or... is there any chance of creating a btree database on Windows/Linux?

Re: 2nd ESP8266 projects stretch goal - Embedded Database (btree module)

Posted: Sun Aug 06, 2017 6:48 pm
by pfalcon
Yes, btree module is included in Unix build, and database file format should be portable across systems.

Re: 2nd ESP8266 projects stretch goal - Embedded Database (btree module)

Posted: Sun Aug 06, 2017 10:00 pm
by crizeo
I could not find the btree module (Oracle Berkeley DB 1.8.5). The only thing I can install on windows or Unix is Oracle Berkeley 6.x or something... Is there a python script or another simple possibility for creating a btree file on Unix (as it is exists in Micropython)?

Re: 2nd ESP8266 projects stretch goal - Embedded Database (btree module)

Posted: Sun Aug 06, 2017 11:32 pm
by jcea
@crizeo, you must compile Micropython in a regular Unix/Linux host, use its btree module to generate the file you what and then copy that file to the ESP8266 device.

Re: 2nd ESP8266 projects stretch goal - Embedded Database (btree module)

Posted: Sun Aug 06, 2017 11:41 pm
by crizeo
@jcea: Thanks! Is there a tutorial or something on compiling MicroPython on Linux/UNIX?

Re: 2nd ESP8266 projects stretch goal - Embedded Database (btree module)

Posted: Mon Aug 07, 2017 7:22 am
by deshipu
See the README.txt in the top of MicroPython repository.

Re: 2nd ESP8266 projects stretch goal - Embedded Database (btree module)

Posted: Mon Aug 07, 2017 5:18 pm
by crizeo
Thanks a lot! Got it working on Linux (after apt-get install libffi-dev python-dev).