{ "info": { "author": "Caleb P. Burns", "author_email": "cpburnz@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Database", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "\n*sqlparams*: SQL Parameters\n===========================\n\n*sqlparams* is a utility module for simplifying the use of SQL\nparameters in queries. Some `Python DB API 2.0`_ compliant modules only\nsupport the ordinal *qmark* or *format* style parameters (e.g., pyodbc_\nonly supports *qmark*). This utility module provides a helper class,\n*SQLParams*, that is used to support named parameter styles such as\n*named*, *numeric* and *pyformat*, and have them safely converted to the\ndesired ordinal style.\n\n.. _`Python DB API 2.0`: http://www.python.org/dev/peps/pep-0249/\n.. _pyodbc: https://github.com/mkleehammer/pyodbc\n\n\nTutorial\n--------\n\nYou first create an *SQLParams* instance specifying the named\nparameter style you're converting from, and what ordinal style you're\nconverting to. Let's convert from *named* to *qmark* style::\n\n >>> import sqlparams\n >>> query = sqlparams.SQLParams('named', 'qmark')\n\nNow, lets to convert a simple SQL SELECT query using the *.format()*\nmethod which accepts an SQL query, and a *dict* of parameters::\n\n >>> sql, params = query.format('SELECT * FROM users WHERE name = :name;', {'name': \"Thorin\"})\n\nThis returns the new SQL query using ordinal *qmark* parameters with the\ncorresponding list of ordinal parameters, which can be passed to the\n`.execute()`_ method on a database cursor::\n\n >>> print sql\n SELECT * FROM users WHERE name = ?;\n >>> print params\n ['Thorin']\n\n.. _`.execute()`: http://www.python.org/dev/peps/pep-0249/#id15\n\n*tuple*\\ s are also supported which allows for safe use of the SQL IN\noperator::\n\n >>> sql, params = query.format(\"SELECT * FROM users WHERE name IN :names;\", {'names': (\"Dori\", \"Nori\", \"Ori\")})\n >>> print sql\n SELECT * FROM users WHERE name in (?,?,?);\n >>> print params\n ['Dori', 'Nori', 'Ori']\n\nYou can also format multiple parameters for a single, shared query\nuseful with the `.executemany()`_ method of a database cursor::\n\n >>> sql, manyparams = query.formatmany(\"UPDATE users SET age = :age WHERE name = :name;\", [{'name': \"Dwalin\", 'age': 169}, {'name': \"Balin\", 'age': 178}])\n >>> print sql\n UPDATE users SET age = ? WHERE name = ?;\n >>> print manyparams\n [[169, 'Dwalin'], [178, 'Balin']]\n\n.. _`.executemany()`: http://www.python.org/dev/peps/pep-0249/#executeman\n\nPlease note that if a tuple is used in *.formatmany()*, the tuple must\nbe the same size in each of the parameter lists. Otherwise, you might\nwell use *.format()* in a for-loop.\n\n\nSource\n------\n\nThe source code for *sqlparams* is available from the GitHub repo\n`cpburnz/python-sql-parameters`_.\n\n.. _`cpburnz/python-sql-parameters`: https://github.com/cpburnz/python-sql-parameters.git\n\n\nInstallation\n------------\n\n*sqlparams* can be installed from source with::\n\n python setup.py install\n\n*sqlparams* is also available for install through PyPI_::\n\n pip install sqlparams\n\n.. _PyPI: http://pypi.python.org/pypi/sqlparams\n\n\nDocumentation\n-------------\n\nDocumentation for *sqlparams* is available on `Read the Docs`_.\n\n.. _`Read the Docs`: https://python-sql-parameters.readthedocs.org\n\n\nChange History\n==============\n\n1.1.2 (2018-05-04)\n------------------\n\n- Improved support for byte strings.\n\n\n1.1.1 (2017-09-07)\n------------------\n\n- Fixed support for byte strings.\n\n\n1.1.0 (2017-08-30)\n------------------\n\n- Support Python 3.2+.\n\n\n1.0.3 (2012-12-28)\n------------------\n\n- Fixed documentation for `issue 1`_.\n\n.. _`issue 1`: https://github.com/cpburnz/python-sql-parameters/issues/1\n\n\n1.0.2 (2012-12-22)\n------------------\n\n- Added sphinx documentation.\n\n\n1.0.1 (2012-12-20)\n------------------\n\n- Fixed running test as a script.\n\n\n1.0.0 (2012-12-20)\n------------------\n\n- Initial release.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/cpburnz/python-sql-parameters.git", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "sqlparams", "package_url": "https://pypi.org/project/sqlparams/", "platform": "", "project_url": "https://pypi.org/project/sqlparams/", "project_urls": { "Homepage": "https://github.com/cpburnz/python-sql-parameters.git" }, "release_url": "https://pypi.org/project/sqlparams/1.1.2/", "requires_dist": null, "requires_python": "", "summary": "Convert DB API 2.0 named parameters to ordinal parameters.", "version": "1.1.2" }, "last_serial": 3836083, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "652641ea5d0f7005e4ebefb831c76cad", "sha256": "e5bb86ba3ab4e495038657ecec9e48e7d93bad74622ae2601baeb863b1a1036d" }, "downloads": -1, "filename": "sqlparams-1.0.0.tar.gz", "has_sig": false, "md5_digest": "652641ea5d0f7005e4ebefb831c76cad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6532, "upload_time": "2012-12-20T05:52:42", "url": "https://files.pythonhosted.org/packages/06/44/263f1efdfd48c5ce79056285d4d76903d659492cfa4629fd0c4640529a57/sqlparams-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "4d9dfe673df4d3db1efb2959db4f2169", "sha256": "4271f758c1330887cb8e6e154e9f989645648551a53f0f130c4fed5f07041b80" }, "downloads": -1, "filename": "sqlparams-1.0.1.tar.gz", "has_sig": false, "md5_digest": "4d9dfe673df4d3db1efb2959db4f2169", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6578, "upload_time": "2012-12-20T05:58:39", "url": "https://files.pythonhosted.org/packages/1f/e4/4abba3403ea59b1b0a36336389aeecf082e18967d64a0a9233b527177479/sqlparams-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "42d86fd678d7f04afe1543da3d83ff48", "sha256": "a63df4cc6a5d29fff9c7c45aecd5ace3b749a60ae5e6103ffcde91068bf05fee" }, "downloads": -1, "filename": "sqlparams-1.0.2.tar.gz", "has_sig": false, "md5_digest": "42d86fd678d7f04afe1543da3d83ff48", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11725, "upload_time": "2012-12-22T05:32:02", "url": "https://files.pythonhosted.org/packages/77/3d/041ffea39d2d3ba29f108a3441ee72001345ba6fecd73a9ae9c05c2ee049/sqlparams-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "34be61c11f96a907b715665667833c55", "sha256": "07fdd7f5a822d7b04466c690751183df2db5ffffb21d5eb562eee422a0b11161" }, "downloads": -1, "filename": "sqlparams-1.0.3.tar.gz", "has_sig": false, "md5_digest": "34be61c11f96a907b715665667833c55", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12817, "upload_time": "2012-12-28T11:56:09", "url": "https://files.pythonhosted.org/packages/27/3f/121bcd3d1dcf6e38f6afa298fed9fc6c799f8b2d492129ef66ee95fea575/sqlparams-1.0.3.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "9d63baca5f65c24bcd695ef7d7df19de", "sha256": "4ff8fcdf1c1e56159562b4aabce9761116b149aeb1f1b9eb8f27e4211b46bea7" }, "downloads": -1, "filename": "sqlparams-1.1.0.tar.gz", "has_sig": false, "md5_digest": "9d63baca5f65c24bcd695ef7d7df19de", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13313, "upload_time": "2017-08-30T23:09:36", "url": "https://files.pythonhosted.org/packages/ad/04/91d8f1d5330739ee471ff09cc8077a854d73a440b80f5758f61b14efe2bd/sqlparams-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "f1acf34bdb435f4142d4d5b01a241f92", "sha256": "242659638ed8de6a96686d9be73deefc3dd70c1ee91dd2e60a4dd41cdd38b92e" }, "downloads": -1, "filename": "sqlparams-1.1.1.tar.gz", "has_sig": false, "md5_digest": "f1acf34bdb435f4142d4d5b01a241f92", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13357, "upload_time": "2017-09-08T01:34:50", "url": "https://files.pythonhosted.org/packages/14/eb/f70bc18481a1e4bfce0f38b1bdbabc5b30489f62c9b2e191d7f5ce71d5c3/sqlparams-1.1.1.tar.gz" } ], "1.1.2": [ { "comment_text": "", "digests": { "md5": "e1818cef6ffd7f6a2321eb7c7d7407c0", "sha256": "a59975569ef97083b215eaca21c80e5213e66396a4def1f00db0c661574641f6" }, "downloads": -1, "filename": "sqlparams-1.1.2.tar.gz", "has_sig": false, "md5_digest": "e1818cef6ffd7f6a2321eb7c7d7407c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13482, "upload_time": "2018-05-05T01:02:13", "url": "https://files.pythonhosted.org/packages/79/82/381b904e8685c207594ef8ded7f2fc4d63f27aea87bbbaf64eff8d87bce4/sqlparams-1.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e1818cef6ffd7f6a2321eb7c7d7407c0", "sha256": "a59975569ef97083b215eaca21c80e5213e66396a4def1f00db0c661574641f6" }, "downloads": -1, "filename": "sqlparams-1.1.2.tar.gz", "has_sig": false, "md5_digest": "e1818cef6ffd7f6a2321eb7c7d7407c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13482, "upload_time": "2018-05-05T01:02:13", "url": "https://files.pythonhosted.org/packages/79/82/381b904e8685c207594ef8ded7f2fc4d63f27aea87bbbaf64eff8d87bce4/sqlparams-1.1.2.tar.gz" } ] }