Skip to main content

Using JSON as very lightweight database

Project description

JSON-as-DB

Python Version Badge RTD PyTest Badge PyPI Version Badge PyPI Download Badge Hits Badge

Using JSON as very lightweight database

>>> db = Database()
>>> db.load('output.json')   # Load database from file
>>> db.add([{                # Add items what you want to add
...   "id": "1002",
...   "type": "Chocolate"
... })
['FqkmbYFSCRCAHQWydhM69v', 'RUJGcVBFANvNRReXa8U3En']
>>> db.save('output.json', json_kwds={'indent': 4})   # Just save it into file.
// output.json
{
    "created_at": "2022-12-25T16:50:02.459068",
    "creator": "json_as_db",
    "data": {
        "FqkmbYFSCRCAHQWydhM69v": {
            "id": "1001",
            "type": "Regular"
        },
        "RUJGcVBFANvNRReXa8U3En": {
            "id": "1002",
            "type": "Chocolate"
        }
    },
    "updated_at": "2022-12-28T16:51:36.276790",
    "version": "1.0.0"
}

Documentation

Installation

Installing via pip:

pip install json-as-db

Installing via GitHub repository,

git clone https://github.com/joonas-yoon/json-as-db.git
pip install -e json-as-db

Contributing

Contributing guidelines can be found CONTRIBUTING.md.

Welcome all contributions to the community and feel free to contribute.

License

Under the MIT license. See the LICENSE file for more info.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

json_as_db-0.2.4.tar.gz (10.2 kB view hashes)

Uploaded Source

Built Distribution

json_as_db-0.2.4-py3-none-any.whl (11.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page