{"id":20139274,"url":"https://github.com/harryho/flata","last_synced_at":"2025-04-09T18:22:17.410Z","repository":{"id":49349519,"uuid":"98073267","full_name":"harryho/flata","owner":"harryho","description":"Python json format document oriented database. Inspired by TinyDB and lowdb","archived":false,"fork":false,"pushed_at":"2017-09-17T13:03:42.000Z","size":120,"stargazers_count":41,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T20:22:30.322Z","etag":null,"topics":["document-database","json","jsondb","nosql","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/harryho.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-23T03:57:07.000Z","updated_at":"2024-11-21T04:40:57.000Z","dependencies_parsed_at":"2022-08-30T14:31:47.524Z","dependency_job_id":null,"html_url":"https://github.com/harryho/flata","commit_stats":null,"previous_names":["harryho/pseudb"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryho%2Fflata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryho%2Fflata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryho%2Fflata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryho%2Fflata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harryho","download_url":"https://codeload.github.com/harryho/flata/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248085700,"owners_count":21045195,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["document-database","json","jsondb","nosql","python"],"created_at":"2024-11-13T21:44:37.497Z","updated_at":"2025-04-09T18:22:17.387Z","avatar_url":"https://github.com/harryho.png","language":"Python","readme":"Flata\n----\n\n|Build Status| |Coverage| |Version|\n\n\nFlata is inspired by TinyDB_ and lowdb_. It is a lightweight document \noriented database optimized for FlatApi and fun :) It's written in pure\nPython and has no external dependencies. The target are small apps or \nfake api that would be blown away by a SQL-DB or an external database server.\n\nMany thanks to :\n================\n\nMarkus Siemens's TinyDB. All credit should go to Markus, upon his hard work\nI can create the Flata as what I want. I borrow some concepts from lowdb which \nwill have better support for Restful API. \n\nDifference between TinyDB and Flata\n\n- **No default table** The _default table has been removed from Flata. User needs to create a table first before inserting any data. \n\n- **Built-in ID** Flata always attachs a built-in id field, to every record, but user can customize the built-in id field as they prefer. \n\n- **Only table object can execute CRUD** The instance of TinyDB can execute CRUD actions, but it is different story in Flata. In Flata only the instance of table is allowed to execute CRUD actions. This concept is borrowed from lowdb. \n\n- **Return object instead of ID** Flata will return new or updated objects with IDs after the data is inserted or updated. It is good for Restful API to present the latest data in the database. \n\n- **Format of database is not compatible** Database file created by TinyDB will not be compatible with Flata, because data structure stored as list in Flata instead of dict in TinyDB. \n\n\nInstallation\n************\n\n- Via pypi\n\n.. code-block:: bash\n\n    $ pip install flata\n\n- Via github\n\n.. code-block:: bash\n\n    $ pip install -e git+https://github.com/harryho/flata@master#egg=flata\n\n\nExample code\n************\n\n- Create database file with empty table1\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from flata import Flata, where\n    \u003e\u003e\u003e from flata.storages import JSONStorage\n    \u003e\u003e\u003e db = Flata('/path/to/db.json', storage=JSONStorage)\n    \u003e\u003e\u003e db.table('table1') # Method table will create or retrieve if it exists\n    \u003e\u003e\u003e db.get('table1')  # Method get only retrieve the table it exists\n\n- Insert or update data into table1\n\n.. code-block:: python\n\n    \u003e\u003e\u003e db.table('table1').insert({'data':1 })\n    \u003e\u003e\u003e db.get('table1').insert({'data':2 })\n    \u003e\u003e\u003e tb = db.get('table1')\n    \u003e\u003e\u003e tb.all()\n    \u003e\u003e\u003e tb.update({'data': 100}, where('data') ==1 )\n    \u003e\u003e\u003e tb.all()\n\n\n- Query data from table1\n\n.. code-block:: python\n\n    \u003e\u003e\u003e tb = db.get('table1')\n    \u003e\u003e\u003e tb.search(Query().data == 2)\n\n- Customize default unique id field `id`\n\n.. code-block:: python\n\n    \u003e\u003e\u003e tb2 = db.table('table2' , id_field = '_guid')\n    \u003e\u003e\u003e tb2.insert({'data':1 })\n    \u003e\u003e\u003e tb2.all()\n\n\nStable release\n**************\n- |Flata 4.0.0|\n\n\n\nOld versions\n************\n- |Flata 3.3.1|\n- |Flata 3.2.0|\n\n\n\nChange log\n**********\n\n- Flata 3.2.0\n\n    Add ignore case feature for search and match methods\n\n- Flata 3.1.0\n\n    Change the get method \n\n- Flata 3.0.0 \n\n    Change the built-in field from '_oid' to 'id'.\n\n\n\n.. |Build Status| image:: https://travis-ci.org/harryho/flata.svg?branch=master\n    :target: https://travis-ci.org/harryho/flata\n.. |Coverage| image:: https://coveralls.io/repos/github/harryho/flata/badge.svg?branch=master\n    :target: https://coveralls.io/github/harryho/flata?branch=master\n.. |Version| image:: https://badge.fury.io/py/flata.svg\n    :target: https://badge.fury.io/py/flata\n.. _TinyDB: https://github.com/msiemens/tinydb\n.. _lowdb: https://github.com/typicode/lowdb\n\n.. |Flata 1.1.0| :target:: https://pypi.python.org/pypi?:action=display\u0026name=flata\u0026version=1.1.0\n.. |Flata 2.0.0| :target:: https://pypi.python.org/pypi?:action=display\u0026name=flata\u0026version=2.0.0\n.. |Flata 2.1.0| :target:: https://pypi.python.org/pypi?:action=display\u0026name=flata\u0026version=3.1.0 \n.. |Flata 3.2.0| :target:: https://pypi.python.org/pypi?:action=display\u0026name=flata\u0026version=3.2.0 \n.. |Flata 3.3.1| :target:: https://pypi.python.org/pypi?:action=display\u0026name=flata\u0026version=3.3.1\n.. |Flata 4.0.0| :target:: https://pypi.python.org/pypi?:action=display\u0026name=flata\u0026version=4.0.0\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharryho%2Fflata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharryho%2Fflata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharryho%2Fflata/lists"}