{ "info": { "author": "Tobias Ammann", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.6", "Topic :: Database :: Front-Ends" ], "description": "sqlitent - namedtuples inside sqlite databases\n==============================================\nsqlitent provides a set-like interface on top of SQLite_. Values can\nbe None, int, float, str, and bytes. Tuple types are distinguished by\nname (case sensitive!) and number of fields. Documentation_.\n\nsqlitent was inspired by sqlitedict_ and kv_.\n\nExample\n-------\n\n::\n\n >>> from collections import namedtuple\n >>> from sqlitent import sqlitent, fuzzy\n >>> db = sqlitent('database.sqlite', autocommit=True)\n >>>\n >>> Point = namedtuple('Point', ['x', 'y'])\n >>> p1 = Point(11, y=22)\n >>> p1\n Point(x=11, y=22)\n >>> p2 = p._replace(x=33)\n Point(x=33, y=22)\n >>> Car = namedtuple('Car', [\n ... 'brand',\n ... 'model',\n ... 'configuration',\n ... 'hp',\n ... ])\n >>> c = Car('Audi', 'A1', 'Sport 1.8 TFSI S tronic', 192)\n >>> c\n Car(brand='Audi', model='A1', configuration='Sport 1.8 TFSI S tronic', hp=192)\n >>> db.register(Point, Car) # necessary to read tuples\n\nIn addition to the methods which the set type provides, there are convenience\nmethods (insert, delete) that handle multiple tuples at once.\n\n::\n\n >>> db.add(p1)\n >>> db.remove(p1)\n >>> db.insert(p1, p2)\n >>> db.delete(p1, p2)\n >>> db.insert([p1], [[p1], p2])\n >>> db.insert(c)\n >>> db.insert([c, p1]) # tuples may be of different types\n\nOf course, sqlitent also supports membership checking and counting:\n\n::\n\n >>> d = c._replace(configuration='1.6 TDI S tronic', hp=116)\n >>> d in db\n False\n >>> len(db)\n 3\n >>> db.insert(d)\n >>> d in db\n True\n >>> len(db) # ...now we have 4 unique tuples in the database.\n 4\n\nThere are various ways to retreive tuples from the database:\n\n::\n\n >>> p3 = db.one(Point) # not deterministic\n >>> p3\n Point(x=11, y=22)\n >>> p3 = db.one(p3) # deterministic (since p3 is fully specified)\n >>> p3 in db\n True\n >>> db.pop(p3) # remove and return\n Point(x=11, y=22)\n >>> p3 in db\n False\n >>> db.pop(Point) # not deterministic\n Point(x=33, y=22)\n >>> db.pop(Point) # returns None since there are no more Point tuples\n >>>\n\nObviously there are also functions to retrieve or pop multiple values out\nof the database. sqlitent also supports fuzzy matching on text fields and\nfilter functions:\n\n::\n\n >>> cs = db.many(Car) # get all cars\n >>> cs\n \n >>> list(cs)\n [Car(brand='Audi', model='A1', configuration='Sport 1.8 TFSI S tronic', hp=192),\n Car(brand='Audi', model='A1', configuration='1.6 TDI S tronic', hp=116)]\n >>> d = list(db.popmany(Car, configuration=fuzzy('%TDI%')))\n >>> any(x in db for x in d) # we removed all TDI cars from the database\n False\n >>> list(db.many(Car, hp=lambda v: v > 150))\n [Car(brand='Audi', model='A1', configuration='Sport 1.8 TFSI S tronic', hp=192)]\n >>> list(db.many(Car, brand='Kia'))\n []\n\n\nThis library is MIT licensed.\n\n\n.. _Sqlite: https://sqlite.org/\n.. _Documentation: https://digitalmensch.github.io/sqlitent/\n.. _sqlitedict: https://github.com/RaRe-Technologies/sqlitedict\n.. _kv: https://github.com/mgax/kv\n.. _code: https://github.com/digitalmensch/sqlitent", "description_content_type": null, "docs_url": null, "download_url": "https://pypi.python.org/pypi/sqlitent", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/digitalmensch/sqlitent", "keywords": "sqlite,persistent set,namedtuple", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "sqlitent", "package_url": "https://pypi.org/project/sqlitent/", "platform": "any", "project_url": "https://pypi.org/project/sqlitent/", "project_urls": { "Download": "https://pypi.python.org/pypi/sqlitent", "Homepage": "https://github.com/digitalmensch/sqlitent" }, "release_url": "https://pypi.org/project/sqlitent/0.2.1/", "requires_dist": null, "requires_python": "", "summary": "namedtuples inside set-like sqlite databases", "version": "0.2.1" }, "last_serial": 3467330, "releases": { "0.2.1": [ { "comment_text": "", "digests": { "md5": "98db73befde3fee3a4409e77f1641ec9", "sha256": "d1bac70edda04f90efb2b40ed9bdb4a0e9a63a0bec2e42fb2ced72e9c77fe733" }, "downloads": -1, "filename": "sqlitent-0.2.1.tar.gz", "has_sig": false, "md5_digest": "98db73befde3fee3a4409e77f1641ec9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5377, "upload_time": "2018-01-06T17:50:28", "url": "https://files.pythonhosted.org/packages/5f/c6/b7988f1478e6b403c839abaa37edb5a13c1974fcbc3a673b3f9f9b34b1f8/sqlitent-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "98db73befde3fee3a4409e77f1641ec9", "sha256": "d1bac70edda04f90efb2b40ed9bdb4a0e9a63a0bec2e42fb2ced72e9c77fe733" }, "downloads": -1, "filename": "sqlitent-0.2.1.tar.gz", "has_sig": false, "md5_digest": "98db73befde3fee3a4409e77f1641ec9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5377, "upload_time": "2018-01-06T17:50:28", "url": "https://files.pythonhosted.org/packages/5f/c6/b7988f1478e6b403c839abaa37edb5a13c1974fcbc3a673b3f9f9b34b1f8/sqlitent-0.2.1.tar.gz" } ] }