NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: choosing a lightweight database



If you are using python as a "front end," the TinyDB package is lightweight and very nice. Think of it as a Mongodb light. Stores data as a JSON. You can add various extensions and has an excellent API. 
https://tinydb.readthedocs.io/en/latest/index.html

Philosophy of TinyDB
TinyDB aims to be simple and fun to use. Therefore, two key values are simplicity and elegance of interfaces and code. These values will contradict each other from time to time. In these cases , try using as little magic as possible. In any case don’t forget documenting code that isn’t clear at first glance. (https://tinydb.readthedocs.io/en/latest/contribute.html#philosophy-of-tinydb)

On 1/15/19, 9:48 PM, "netbsd-users-owner%NetBSD.org@localhost on behalf of reed%reedmedia.net@localhost" <netbsd-users-owner%NetBSD.org@localhost on behalf of reed%reedmedia.net@localhost> wrote:

    Any recommendations on a lightweight database (no extra server process) 
    to use with dynamic website?
    
    It is not a lot of data. Currently stored in ~1000 flat files (all 
    stored in git) and could easily be converted to JSON or XML for readable 
    text store. Each file ranges between 7 and 184 unique (per file) values.
    When done maybe I will have around 10,000 keys and 500,000 attributes 
    like:
    
    1342-rolley-lake-provincial-park flush-toilet=yes
    1342-rolley-lake-provincial-park drinking-water=yes
    1342-rolley-lake-provincial-park drive-up-camping=yes
    1342-rolley-lake-provincial-park showers=yes
    1342-rolley-lake-provincial-park hiking=yes
    1342-rolley-lake-provincial-park hiking-notes="Lakeside Loop is a 40 minute hike."
    1342-rolley-lake-provincial-park state="British Columbia"
    1342-rolley-lake-provincial-park country=ca
    
    1-cedar-ridge-scenic-overlook-dinosaur-valley-state-park flush-toilet=no
    1-cedar-ridge-scenic-overlook-dinosaur-valley-state-park drinking-water=no
    1-cedar-ridge-scenic-overlook-dinosaur-valley-state-park drive-up-camping=no
    1-cedar-ridge-scenic-overlook-dinosaur-valley-state-park showers=no
    1-cedar-ridge-scenic-overlook-dinosaur-valley-state-park firepit=no
    1-cedar-ridge-scenic-overlook-dinosaur-valley-state-park firepit-notes="Ground fires are prohibited; use backpacking stove."
    1-cedar-ridge-scenic-overlook-dinosaur-valley-state-park country=usa
    1-cedar-ridge-scenic-overlook-dinosaur-valley-state-park state=tx
    
    Around 200 attributes, but not all for each.
    
    Also I have key/values like
     FOO-notes="for supplementing text for FOO"
    And description and direction fields with sentences.
    
    The values may be free form text, numbers, boolean yes/no (some values 
    are links to other files).
    
    I generate static webpages easily from this (and can dynamically 
    generate webpages easily).
    
    Storing this in Berkeley DB would be easy.
    
    But I want an easy way to search everything like:
    
    country=ca
    province=alberta
    elevation>=1524 meters
    cost<=5
    
    or keyword searches against description fields.
    
    Any thoughts on lightweight no database server ideas? I may just use 
    sqlite. Minimal dependencies would be great.
    
    Thanks
    
    
    




Home | Main Index | Thread Index | Old Index