{ "info": { "author": "Eugene Van den Bulke", "author_email": "eugene.vandenbulke@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Topic :: Software Development :: Libraries" ], "description": "===\nsql\n===\n\n\nWhy?\n====\n\n`DB API 2.0`_ works. ORMs are convenient but sometimes overkill. ``sql`` is a\nlightweight wrapper sitting on top of any DB API 2.0 connection offering a\npostgres_ like interface which makes working with SQL results bliss.\n\nHow?\n====\n\n>>> import sqlite3\n>>> connection = sqlite3.connect(':memory:')\n\n>>> import sql\n>>> bliss = sql.SQL(connection)\n\nrun\n---\n\n`run` is the method to use when you want to run a query but do not care about\nthe result e.g. to create a table:\n\n>>> bliss.run(\"CREATE TABLE contributors (firstname VARCHAR, lastname VARCHAR)\")\n>>> bliss.run(\"INSERT INTO contributors VALUES (?, ?)\", [('Andrew', 'Kuchling'),\n... ('James', 'Henstridge'),\n... ('Daniele', 'Varrazzo'),\n... ('Marc-Andre', 'Lemburg')])\n\nNothing impressive so far, creating a cursor and calling executemany would achieve\nthe same result.\n\none\n---\n\n`one` is the method to use when you know the result is a single row or only care\nabout one.\n\n>>> bliss.one(\"SELECT firstname FROM contributors WHERE lastname='Lemburg'\") # doctest: +SKIP\nu'Marc-Andre'\n\nThe string, nothing but the string, which in my book beats:\n\n>>> cursor = connection.cursor()\n>>> cursor.execute(\"SELECT firstname FROM contributors WHERE lastname='Lemburg'\") # doctest: +ELLIPSIS\n\n>>> cursor.fetchone() # doctest: +SKIP\n(u'Marc-Andre',)\n\nEven better, if the result contains several column, one returns a namedtuple_:\n\n>>> bliss.one(\"SELECT * FROM contributors WHERE firstname='James'\") # doctest: +SKIP\nRecord(firstname=u'James', lastname=u'Henstridge')\n\nall\n---\n\n`all` is the method to use to retrieve all rows from a query.\n\n>>> bliss.all(\"SELECT firstname FROM contributors\") #doctest: +SKIP\n[u'Andrew', u'James', u'Daniele', u'Marc-Andre']\n\nIt returns a list of namedtuples when appropriate:\n\n>>> bliss.all(\"SELECT firstname, LENGTH(lastname) AS length FROM contributors\") # doctest: +NORMALIZE_WHITESPACE +SKIP\n[Record(firstname=u'Andrew', length=8),\n Record(firstname=u'James', length=10),\n Record(firstname=u'Daniele', length=8),\n Record(firstname=u'Marc-Andre', length=7)]\n\n.. _DB API 2.0: http://www.python.org/dev/peps/pep-0249/\n.. _postgres: https://postgres-py.readthedocs.org/en/latest/\n.. _namedtuple: http://docs.python.org/3/library/collections.html#collections.namedtuple", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/3kwa/sql", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "sql", "package_url": "https://pypi.org/project/sql/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/sql/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/3kwa/sql" }, "release_url": "https://pypi.org/project/sql/0.4.0/", "requires_dist": null, "requires_python": null, "summary": "DB API 2.0 for Humans", "version": "0.4.0" }, "last_serial": 961583, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "329ee78725eb2433eade77d53fc849dc", "sha256": "0a8a23668a989197498d5b9ca6ebf716cff1c64c5fa4fb84fc0de6f3f3c4b8ae" }, "downloads": -1, "filename": "sql-0.1.0.tar.gz", "has_sig": false, "md5_digest": "329ee78725eb2433eade77d53fc849dc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2180, "upload_time": "2013-12-18T05:31:12", "url": "https://files.pythonhosted.org/packages/5b/5d/f13c1c640a974dd92d33dba16a400c79ab684b4b294bea66773902c5616a/sql-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "6704e7b3e8cadc936e55c7951600f475", "sha256": "f4d370b252b6f51a66c2a1f4725a5d34ba0ed5c7590908c97c9912ae27e3bc3a" }, "downloads": -1, "filename": "sql-0.1.1.tar.gz", "has_sig": false, "md5_digest": "6704e7b3e8cadc936e55c7951600f475", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2434, "upload_time": "2013-12-18T05:32:29", "url": "https://files.pythonhosted.org/packages/10/59/bd76d0ae600afd1a47dca87535bcec5df84fb3d50b0736781a7c1328ac16/sql-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "a947cc3bfc7120f35c240d0b93e5eaa0", "sha256": "bfdb8bfe126c3276c03ccdcdbe12e13ff4a76fa5ee3f8d5b9928e7c7e3a7dae0" }, "downloads": -1, "filename": "sql-0.2.0.tar.gz", "has_sig": false, "md5_digest": "a947cc3bfc7120f35c240d0b93e5eaa0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3573, "upload_time": "2013-12-19T00:41:05", "url": "https://files.pythonhosted.org/packages/af/ca/d8987dee26d5ae87386e72ee26453e8fd50bad9c38c1a0708797d368aec2/sql-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "048b3ef0ac5eb0c0628ea51f0bfeccf5", "sha256": "fe86f6a5180219f796a71ef57f41c03733d6f7dcd477eb44c00089fb58d6ad70" }, "downloads": -1, "filename": "sql-0.3.0.tar.gz", "has_sig": false, "md5_digest": "048b3ef0ac5eb0c0628ea51f0bfeccf5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3568, "upload_time": "2014-01-02T18:30:52", "url": "https://files.pythonhosted.org/packages/d2/40/29c3c66accb65bed33d8198f599a231cbf209a5df148b794b701cd33efff/sql-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "04b89730b9c5432dddc83e6f33ddb326", "sha256": "7c96955a2f5e99e38e0e5527da2c4be00b0b372ed4d33b5152c8fb71478318ea" }, "downloads": -1, "filename": "sql-0.4.0.tar.gz", "has_sig": false, "md5_digest": "04b89730b9c5432dddc83e6f33ddb326", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3587, "upload_time": "2014-01-06T09:39:43", "url": "https://files.pythonhosted.org/packages/2a/19/bee8cf05626674f892fc7745205ff010474cd523a23b555851ba4fa7bb5f/sql-0.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "04b89730b9c5432dddc83e6f33ddb326", "sha256": "7c96955a2f5e99e38e0e5527da2c4be00b0b372ed4d33b5152c8fb71478318ea" }, "downloads": -1, "filename": "sql-0.4.0.tar.gz", "has_sig": false, "md5_digest": "04b89730b9c5432dddc83e6f33ddb326", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3587, "upload_time": "2014-01-06T09:39:43", "url": "https://files.pythonhosted.org/packages/2a/19/bee8cf05626674f892fc7745205ff010474cd523a23b555851ba4fa7bb5f/sql-0.4.0.tar.gz" } ] }