{ "info": { "author": "Daniel Fairhead", "author_email": "danthedeckie@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Programming Language :: Python :: 2.7", "Topic :: Database" ], "description": "=============\nDictLiteStore\n=============\n\nA dynamic-schema sqlite backend for storing python dicts in a queriable\ndatabase.\n\nAll values within the dict are stored as json values\nin the database, but the keys are mapped into table columns, So you can\nquery things , while it's still very easy to parse.\n\nWhen you try to add a dict which has keys which *aren't* in the table\nalready, it will automatically add those columns.\n\nSo a dict: ::\n\n {'author': 'dan',\n 'project': 'DictLiteStore',\n 'categories': ['python', 'dict', 'persistance']\n }\n\nbecomes in the database:\n\n\n+-----------+---------------------+---------------------------------------+\n| AUTHOR | PROJECT | CATEGORIES |\n+===========+=====================+=======================================+\n| ``\"dan\"`` | ``\"DictLiteStore\"`` | ``[\"python\", \"dict\", \"persistance\"]`` |\n+-----------+---------------------+---------------------------------------+\n\nThis is quite cool, as you can then use regular SQL to query stuff. ::\n\n SELECT * FROM 'dict_store' WHERE 'author' == '\"dan\"'\n\nfor instance. (Note the quotes around the query value.) There is a\nsimple wrapper around the sql select function (get) that you can use if you\ndon't want to run type sql yourself. See the Usage section below.\n\nSince the data is in json form, even for lists (like categories) you\ncan fairly easily query it too. Search for all rows with 'python' in\ncategories, say. Sqllite full-text searches are reasonably fast.\nYou don't get the performance benefits of one-to-many relationship\nqueries, but if you're in a performance critical environment, you\nshould probably be looking at a 'real' SQL server anyway.\n\nWhen the data is returned from sqllite, if you use the\n'get' function in the DictLiteStore module, it will re-convert\njsonified values (say that 'categories' list) back into a python\nlist. This is quite useful. :-)\n\nDictLiteStore was initially just an experiment for a later part of\nmarlinespike's cacheing system, but as a stand-alone module,\nis useful for many data storage systems.\n\n======\nUsage:\n======\n\nTake a dict of data::\n\n foo = {'title': 'Foo the first', 'dict':'Bar Bar Bar'}\n\n with DictLiteStore('data.db', 'table_of_random_stuff') as bucket:\n bucket.store(foo)\n\nNow the dictionary 'foo' is stored as a row in data.db\nYou can either use SQLlite queries directly to access the data,\nor there is a very simple SELECT wrapper which can be helpful for simple\nstuff: ::\n\n\n bucket.get(('title','LIKE',NoJSON('%Foo%')))\n\nreturns ::\n\n [{'title':'Foo the first','dict':'Bar Bar Bar'}]\n\nTo update the table, you also use the update() method: ::\n\n bucket.update({'title':'updated title'})\n\nwould update *all* rows to have the new title. We can use the 'where' clause\nlike in get to limit the damage: ::\n\n bucket.update({'title': 'updated title'},\n True,\n ('title', '==', 'old title'))\n\nWhat's that random 'True' there for, you want to know?\n\nThe update method needs to know if you want it to write the dict (insert it)\ninto the table if the where clause fails. If you want to ONLY update, and not\ninsert if there is no matching row, then run update like this: ::\n\n bucket.update({'title':'updated title'},\n False,\n ('title','==','old title'))\n\n\n======\nNotes:\n======\n\n* All data is serialised into json before writing, and deserialised on the way out.\n This means strings do get extra quotes around them. There could be a way to do this better,\n but I'm not quite sure of the most efficient. (Try and deserialise, if it doesn't work,\n leave as string? Too many false positives, I'd have thought...)\n* All non-jsonable data is stringified first, and then json'd.\n* Currenly very little error-checking happens. Before production, this needs\n a lot of shoring-up around the edges.\n* I need to do some performance experiments! How well does this actually work, speed wise?", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/danthedeckie/DictLiteStore/tarball/0.9.3", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/danthedeckie/DictLiteStore", "keywords": "json,dict,persistance,sqlite,dynamic schema", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "DictLiteStore", "package_url": "https://pypi.org/project/DictLiteStore/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/DictLiteStore/", "project_urls": { "Download": "https://github.com/danthedeckie/DictLiteStore/tarball/0.9.3", "Homepage": "https://github.com/danthedeckie/DictLiteStore" }, "release_url": "https://pypi.org/project/DictLiteStore/0.9.3/", "requires_dist": null, "requires_python": null, "summary": "A (Dynamic-Schema) dict -> sqlite3 library", "version": "0.9.3" }, "last_serial": 894931, "releases": { "0.9.1": [ { "comment_text": "", "digests": { "md5": "ca50959f1fa305a197affb65be069a9c", "sha256": "f7b09ac67f070b4259ddfcdda06ff619a5d448e9f20c04abe273608d5a1f2646" }, "downloads": -1, "filename": "dictlitestore.tgz", "has_sig": false, "md5_digest": "ca50959f1fa305a197affb65be069a9c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20066, "upload_time": "2013-10-15T12:43:48", "url": "https://files.pythonhosted.org/packages/7e/19/67732d770a2c251c68c68366c35200f39ed8b00f0136b2b37e5c8282e551/dictlitestore.tgz" } ], "0.9.2": [ { "comment_text": "", "digests": { "md5": "5144532e677ebce54df31d045a6ae695", "sha256": "23c9a9f4564a26f749fcf308782629e1be3e88c980f35e6714e71c6b3a1c0c72" }, "downloads": -1, "filename": "DictLiteStore-0.9.2.tar.gz", "has_sig": false, "md5_digest": "5144532e677ebce54df31d045a6ae695", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7290, "upload_time": "2013-10-15T14:42:09", "url": "https://files.pythonhosted.org/packages/74/4c/b8dd16451738303d1744e94cf387c74116841abbb6ddb9bea6cd403512d7/DictLiteStore-0.9.2.tar.gz" } ], "0.9.3": [ { "comment_text": "", "digests": { "md5": "f4f6ba5175ae49873b24d362ffa303f2", "sha256": "97c76ad187ed7851c48fea28e0fc213e65a1fb9a5ed3b493d7629480ad7e45f9" }, "downloads": -1, "filename": "DictLiteStore-0.9.3.tar.gz", "has_sig": false, "md5_digest": "f4f6ba5175ae49873b24d362ffa303f2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6981, "upload_time": "2013-10-15T14:56:52", "url": "https://files.pythonhosted.org/packages/74/84/1de649b18f157feb6122bb235eb285cdb1a7e276371126a52225834cd2fa/DictLiteStore-0.9.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f4f6ba5175ae49873b24d362ffa303f2", "sha256": "97c76ad187ed7851c48fea28e0fc213e65a1fb9a5ed3b493d7629480ad7e45f9" }, "downloads": -1, "filename": "DictLiteStore-0.9.3.tar.gz", "has_sig": false, "md5_digest": "f4f6ba5175ae49873b24d362ffa303f2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6981, "upload_time": "2013-10-15T14:56:52", "url": "https://files.pythonhosted.org/packages/74/84/1de649b18f157feb6122bb235eb285cdb1a7e276371126a52225834cd2fa/DictLiteStore-0.9.3.tar.gz" } ] }