{ "info": { "author": "Bruno Bord", "author_email": "bruno@jehaisleprintemps.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Database" ], "description": "MeuhDb\r\n======\r\n\r\n The database that says \"Meuh\"\r\n\r\n|Build Status| |Coverage Status|\r\n\r\n**MeuhDb** is a \"dummy\" key / JSON value store written in Python.\r\n\r\nInstall\r\n-------\r\n\r\nTo install the latest release:\r\n\r\n::\r\n\r\n pip install meuhdb\r\n\r\n... but since this is a very early release, you'd better stick to this\r\nGithub source repository. You may want to read `the\r\nChangelog `__,\r\ntoo.\r\n\r\nBasic usage\r\n-----------\r\n\r\n.. code:: python\r\n\r\n >>> from meuhdb import MeuhDb\r\n >>> db = MeuhDb() # Create in-memory database\r\n >>> db.set('one', {'name': 'Alice', 'good': True, 'chief': True})\r\n >>> db.set('two', {'name': 'Bob', 'good': True})\r\n >>> db.set('three', {'name': 'Carl', 'good': False})\r\n >>> db.filter(name='Alice')\r\n {'one': {'chief': True, 'good': True, 'name': 'Alice'}}\r\n >>> db.filter(good=True)\r\n {'two': {'good': True, 'name': 'Bob'}, 'one': {'chief': True, 'good': True, 'name': 'Alice'}}\r\n >>> db.filter(good=True, chief=True) # More than one criteria, it's a \"AND\"\r\n {'one': {'chief': True, 'good': True, 'name': 'Alice'}\r\n >>> db.delete('one')\r\n >>> db.filter(name='Alice')\r\n {}\r\n >>> db.exists('one')\r\n False\r\n >>> db.insert({'name': 'John'})\r\n 'eb3c3a1d-8999-4052-9e3c-2f3542c047b1'\r\n >>> db.update('eb3c3a1d-8999-4052-9e3c-2f3542c047b1', {'age': 42})\r\n >>> db.get('eb3c3a1d-8999-4052-9e3c-2f3542c047b1')\r\n {'age': 42, 'name': 'John'}\r\n\r\nAt the moment, you can only query on \"equalities\", i.e. a strict\r\nequality between what you're looking for and what's in the JSON fields\r\n(no special operator: greater than, different, etc).\r\n\r\nThe values must be JSON serializable values (dictionaries, does not work\r\nwith dates, datetimes, sets, etc.)\r\n\r\nDatabase creation\r\n~~~~~~~~~~~~~~~~~\r\n\r\nThere are a few optional parameters with the ``MeuhDb`` class\r\nconstructor:\r\n\r\n.. code:: python\r\n\r\n MeuhDb(\r\n path=None,\r\n autocommit=False, autocommit_after=None,\r\n lazy_indexes=False,\r\n backend=DEFAULT_BACKEND)\r\n\r\n- ``path``: is the file path of your JSON database if you want to save\r\n it to a file. If the file already exists, **MeuhDb** tries to load\r\n its data. If it's not provided, the DB will be in-memory.\r\n- ``autocommit``: if set to ``True``, every \"write\" operation will be\r\n transmitted to the file. It can be I/O consuming, since the whole DB\r\n is written on the disk every time.\r\n- ``autocommit_after``: A numeric value. If set, the database will be\r\n committed every \"n\" write operations. Bear in mind that if the\r\n ``autocommit`` flag is set, it has priority over the counter.\r\n- ``lazy_indexes``: When set to True, when the DB is written to the\r\n database, only the definition of the indexes is stored, not the index\r\n values themselves. This means the DB is faster at writing times, but\r\n will load slower, because we'll need to rebuild all indexes,\r\n- ``backend``: chose which JSON backend you can use. There are 3\r\n backends possible, from the least efficient, to the best one: \"json\"\r\n (from the standard lib), \"simplejson\", \"jsonlib\", \"yajl\", or \"ujson\".\r\n **MeuhDb** will try to load each one of them and make them available\r\n if you want. The ``DEFAULT_BACKEND`` value will take the most\r\n performing backend value available. If you provide an unavailable\r\n backend, don't worry, **MeuhDb** will fallback to the comfortable\r\n \\`\\ ``json`` from the standard library.\r\n\r\nExample:\r\n\r\n.. code:: python\r\n\r\n >>> db = MeuhDb('hello.json', autocommit=False, backend='ujson')\r\n >>> db.set('1', {'name': 'Alice'}) # data is not on disk\r\n >>> db.commit() # saves to disk\r\n >>> db = MeuhDb('hello.json', autocommit=True)\r\n >>> db.all() # Data is reloaded from the disk\r\n {u'1': {u'name': u'Alice'}}\r\n >>> db.set('2', {'name': 'Bob'}) # data is written on disk\r\n\r\nIndexes\r\n-------\r\n\r\n**MeuhDb** supports index creation. You can index one or more fields to\r\naccelerate queries.\r\n\r\nExample:\r\n\r\n.. code:: python\r\n\r\n >>> db.create_index('name')\r\n >>> db.filter(name='Alice') # Will use this index\r\n\r\n- You don't have to index all the fields available in your JSON values,\r\n only the one you may query on.\r\n- Indexes will be saved on ``commit()`` along with the Database.\r\n- if somehow the index is screwed up, simply create it with the\r\n ``recreate`` argument: ``db.create_index('name', recreate=True)``.\r\n\r\nIndex types\r\n~~~~~~~~~~~\r\n\r\nYou can specify the index type using this:\r\n\r\n::\r\n\r\n db.create_index('name', _type='lazy')\r\n\r\nYou can only create two types of indexes: ``default`` or ``lazy``. Lazy\r\nindexes will not be stored when the database is committed, and will be\r\nreloaded at startup. You can mix default and lazy indexes.\r\n\r\nNote: since all JSON key should be strings, you can't obviously store\r\nindexes with non-string values. As soon as an index receives a\r\nnon-string value (an int or a boolean, for example), it'll be changed\r\ninto a lazy index.\r\n\r\nWarnings\r\n--------\r\n\r\nThis is not a real actual ACID-ready database manager. This will\r\nprobably suit a \"one-user-only\" use case. Opening an loading a large\r\nfile is very I/O consuming. So **MeuhDb** will **never** replace a\r\nproper NoSQL database system.\r\n\r\nHack\r\n----\r\n\r\n**MeuhDb** will work with a standard Python 2 distribution. (I've got\r\nplans to make it Python-3-ready)\r\n\r\nInside a virtualenv, simply clone this repository and install it in dev\r\nmode:\r\n\r\n::\r\n\r\n git clone https://github.com/brunobord/meuhdb.git\r\n cd meuhdb\r\n pip install -e ./\r\n\r\nYou may want to install one or more of these packages to be able to pick\r\none of these enhanced backends:\r\n\r\n- ``simplejson``,\r\n- ``jsonlib`` (or ``jsonlib-python3``),\r\n- ``yajl``,\r\n- ``ujson``\r\n\r\nTo run the tests, you'll have to install ``tox`` (``pip install tox``)\r\nand simply run the command ``tox``.\r\n\r\nTodo\r\n~~~~\r\n\r\nA lot of things are missing. `The Github issues\r\nlist `__ will work as a\r\n\"todo list\". If you have any bug report, suggestion, please do.\r\n\r\n--------------\r\n\r\nLicense\r\n-------\r\n\r\nThis software is published under the terms of the MIT License See the\r\n`LICENSE `__\r\nfile for more information.\r\n\r\n.. |Build Status| image:: https://travis-ci.org/brunobord/meuhdb.svg?branch=master\r\n.. |Coverage Status| image:: https://img.shields.io/coveralls/brunobord/meuhdb.svg", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/brunobord/meuhdb/", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "meuhdb", "package_url": "https://pypi.org/project/meuhdb/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/meuhdb/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/brunobord/meuhdb/" }, "release_url": "https://pypi.org/project/meuhdb/0.3.0/", "requires_dist": null, "requires_python": null, "summary": "MeuhDB, a database that says", "version": "0.3.0" }, "last_serial": 1302283, "releases": { "0.0.1": [ { "comment_text": "built for Darwin-11.4.2", "digests": { "md5": "25f14302d9d72202fd3818d928a8c71a", "sha256": "83c3aa3a2703599307b491c23e02518f696400017108cb560de2fbe23bf84990" }, "downloads": -1, "filename": "meuhdb-0.0.1.macosx-10.7-intel.tar.gz", "has_sig": false, "md5_digest": "25f14302d9d72202fd3818d928a8c71a", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 9388, "upload_time": "2014-10-26T22:28:34", "url": "https://files.pythonhosted.org/packages/e8/bb/3966a59fdb51926e0b5fa21705d677ed88983556b01252ce655671ca1933/meuhdb-0.0.1.macosx-10.7-intel.tar.gz" }, { "comment_text": "", "digests": { "md5": "c9a8c868ba52db3261ba08af2d852a92", "sha256": "c7340f4ecad77c8b5ef58a4cb1eaa6bfad79a6cd591f8666e0ee2b15a6438d2c" }, "downloads": -1, "filename": "meuhdb-0.0.1.tar.gz", "has_sig": false, "md5_digest": "c9a8c868ba52db3261ba08af2d852a92", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4035, "upload_time": "2014-10-26T22:28:31", "url": "https://files.pythonhosted.org/packages/42/5b/91366a4fd5a010fcc8a4cf771432fc760393fdd8c9c68071c96e2a6ad53e/meuhdb-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "ea56850312e5a8200b9b9a134824f030", "sha256": "4f74dd830d5994837e7558228598cec4158219edcf8801288e6a7a44c99bd623" }, "downloads": -1, "filename": "meuhdb-0.0.2.tar.gz", "has_sig": false, "md5_digest": "ea56850312e5a8200b9b9a134824f030", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4387, "upload_time": "2014-10-27T22:07:07", "url": "https://files.pythonhosted.org/packages/09/86/7ed78902ed16b276e22ce1eec6d07aaa1538ee015d591212967c55b72ade/meuhdb-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "845cf1133d10592cab67c765211f5e11", "sha256": "28f48cfdbe66c9ddcd61672f82fc79c993fec99ff188507d70028e0ef9a40947" }, "downloads": -1, "filename": "meuhdb-0.0.3.tar.gz", "has_sig": false, "md5_digest": "845cf1133d10592cab67c765211f5e11", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4554, "upload_time": "2014-10-28T22:04:57", "url": "https://files.pythonhosted.org/packages/b5/f5/b8dd519382a797fd5f1915e9b73b342eeaa066f5931da155188c9a1c8b5d/meuhdb-0.0.3.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "95365c518b127d09918a5ac39c926412", "sha256": "a7c79140458f98e5a3112192683079ef16d5db02ab0a1dff8a56683d0497d1c6" }, "downloads": -1, "filename": "meuhdb-0.1.0.tar.gz", "has_sig": false, "md5_digest": "95365c518b127d09918a5ac39c926412", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7798, "upload_time": "2014-11-08T17:15:23", "url": "https://files.pythonhosted.org/packages/5c/49/83cde1b71143dec8dfaea7f29b858a9ba8c2eea16d884434531999bac7bf/meuhdb-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "eaeda0f43086b76e56e78e1910ba47a4", "sha256": "c0ef475bffe06afc52667e68cfc3eee4749e2d4da1d3f059cbf2231d99e224b0" }, "downloads": -1, "filename": "meuhdb-0.1.1.tar.gz", "has_sig": false, "md5_digest": "eaeda0f43086b76e56e78e1910ba47a4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7814, "upload_time": "2014-11-08T20:55:51", "url": "https://files.pythonhosted.org/packages/6c/f4/10dd082c9a24b5e6fb5bce28d2a4ea814c21840c7ab1ea54417cd332e0cd/meuhdb-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "cb7d481e534242d18dabbdf3f6ec209e", "sha256": "1cc239ffa91c4a13f091cca3cc89316b9bddde9854bb099c65a285c40008f633" }, "downloads": -1, "filename": "meuhdb-0.2.0.tar.gz", "has_sig": false, "md5_digest": "cb7d481e534242d18dabbdf3f6ec209e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9028, "upload_time": "2014-11-09T14:38:32", "url": "https://files.pythonhosted.org/packages/49/3e/8209ca8d38158a920953c0074b3b1c9eb627e88dbffa79b61572b94e305a/meuhdb-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "b46e2391d3ffb3922b69ac5aa9e60d3d", "sha256": "ce5ec27ca7d2d5db505a3fa48e4b6e60f3f6b1cc55b352d5ed83229ffd7a9889" }, "downloads": -1, "filename": "meuhdb-0.3.0.tar.gz", "has_sig": false, "md5_digest": "b46e2391d3ffb3922b69ac5aa9e60d3d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8563, "upload_time": "2014-11-11T11:15:14", "url": "https://files.pythonhosted.org/packages/e7/19/b07995d71d72028abb8f59df1918b86d3cacd6a6fd1279ca80264fc35492/meuhdb-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b46e2391d3ffb3922b69ac5aa9e60d3d", "sha256": "ce5ec27ca7d2d5db505a3fa48e4b6e60f3f6b1cc55b352d5ed83229ffd7a9889" }, "downloads": -1, "filename": "meuhdb-0.3.0.tar.gz", "has_sig": false, "md5_digest": "b46e2391d3ffb3922b69ac5aa9e60d3d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8563, "upload_time": "2014-11-11T11:15:14", "url": "https://files.pythonhosted.org/packages/e7/19/b07995d71d72028abb8f59df1918b86d3cacd6a6fd1279ca80264fc35492/meuhdb-0.3.0.tar.gz" } ] }