Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shir0kamii/tiny-thingy

JSON database with python object notation
https://github.com/shir0kamii/tiny-thingy

Last synced: 9 days ago
JSON representation

JSON database with python object notation

Awesome Lists containing this project

README

        

Tiny-Thingy
###########

Tiny-Thingy is a wrapper around TinyDB_ that makes it more Pythonic.

Status
======

Tiny-Thingy is maintained, feel free to open issues or pull requests.

Install
=======

.. code-block:: sh

$ pip install tiny-thingy

Examples
========

Setup TinyDB_ database
~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: python

>>> from tiny_thingy import Thingy, use_database
>>> use_database("/some/json/file/serving/as/database.json")

>>> class Task(Thingy):
... pass

The *Task* class will represent the *task* table and instances of it are
documents in this table.

Insert and find thingies
~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: python

>>> task = Task({"name": "work on tiny-thingy"}).save()
>>> Task.count()
1
>>> Task.find_one()
Task({'doc_id': 1, 'name': 'work on tiny-thingy'})

.. _tinyDB: https://github.com/msiemens/tinydb