{ "info": { "author": "Antti Heinonen", "author_email": "antti@heinonen.cc", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: POSIX", "Programming Language :: Python :: 3", "Topic :: Database", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Pgsql\n=====\n\nPostgreSQL client library for Python 3. Simple, fast and lightweight.\n\nInstallation\n------------\n\n::\n\n\t$ pip install pgsql\n\nExample\n-------\n\n.. code-block:: python\n\n\timport pgsql\n\n\t# address defaults to (\"localhost\", 5432), a string must point to a unix socket\n\t# user defaults to \"postgres\"\n\t# password defaults to None\n\t# database equals user by default\n\tdb = pgsql.Connection(user = \"antti\", database = \"postgres\")\n\tprint(db(\"CREATE TABLE people (name TEXT, age INT)\"))\n\tprint(db(\"INSERT INTO people (name, age) VALUES ($1, $2)\", \"Veronica\", 18))\n\tprint(db(\"SELECT * FROM people\"))\n\tdb.close()\n\n\t# for convenience, connection objects support the with statement\n\twith pgsql.Connection(user = \"antti\", database = \"postgres\") as db:\n\t\t# you can use .begin(), .commit(), .rollback() manually, or use the with statement\n\t\twith db.transaction():\n\t\t\twith db.prepare(\"INSERT INTO people (name, age) VALUES ($1, $2)\") as ps:\n\t\t\t\tfor person in (\"Wallace\", 18), (\"Keith\", 45), (\"Lianne\", 44):\n\t\t\t\t\tps(*person)\n\n\t\t# iterate through and print all the rows represented as tuples\n\t\tpeople = db.prepare(\"SELECT * FROM people\")\n\t\tfor person in people():\n\t\t\tprint(person)\n\n\t\t# sometimes instead of an iterator, you want the rows as a list\n\t\t# you may also want to call columns by their name\n\t\tpeople_over = db.prepare(\"SELECT * FROM people WHERE age > $1\").all\n\t\tfor person in people_over(21):\n\t\t\tprint(person.name, \"is\", person.age - 21, \"years over the age of 21\")\n\n\t\t# when the expected result is only one row, it's convenient to call .first\n\t\tperson_named = db.prepare(\"SELECT * FROM people WHERE name = $1 LIMIT 1\").first\n\t\tprint(person_named(\"Veronica\"))\n\t\tprint(person_named(\"Backup\"))\n\nprints\n\n::\n\n\t[]\n\t[]\n\t[('Veronica', 18)]\n\t('Veronica', 18)\n\t('Wallace', 18)\n\t('Keith', 45)\n\t('Lianne', 44)\n\tKeith is 24 years over the age of 21\n\tLianne is 23 years over the age of 21\n\t('Veronica', 18)\n\tNone\n\nChanges\n-------\n\n1.2 (2019-10-27)\n******************\n- Update package description\n\n1.1 (2014-03-26)\n****************\n- Make it possible to execute one-time statements by calling the ``Connection`` object", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://antti.heinonen.cc", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pgsql", "package_url": "https://pypi.org/project/pgsql/", "platform": "POSIX", "project_url": "https://pypi.org/project/pgsql/", "project_urls": { "Homepage": "https://antti.heinonen.cc" }, "release_url": "https://pypi.org/project/pgsql/1.2/", "requires_dist": null, "requires_python": ">=3", "summary": "PostgreSQL client library for Python 3", "version": "1.2", "yanked": false, "yanked_reason": null }, "last_serial": 6037289, "releases": { "1.1": [ { "comment_text": "", "digests": { "md5": "9fe44875a55136f0183e3be12dece7cf", "sha256": "d668ea387fa1924a2deead4be679a96885c4df09604ca8fa4eef19b56421d1bc" }, "downloads": -1, "filename": "pgsql-1.1.tar.gz", "has_sig": false, "md5_digest": "9fe44875a55136f0183e3be12dece7cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4822, "upload_time": "2014-03-26T17:21:33", "upload_time_iso_8601": "2014-03-26T17:21:33.336692Z", "url": "https://files.pythonhosted.org/packages/5b/68/3e5b7935c99c24bd22df002ce2826a42349b1757fbc96651eb99023cc5de/pgsql-1.1.tar.gz", "yanked": false, "yanked_reason": null } ], "1.2": [ { "comment_text": "", "digests": { "md5": "18455695b71b7e9dbdcf65be94a0f1d0", "sha256": "b11b86d2b46fcd8cbfa3d11f970ed92d6ee699f825f1aa5d2ea301a6e30f04f6" }, "downloads": -1, "filename": "pgsql-1.2.tar.gz", "has_sig": false, "md5_digest": "18455695b71b7e9dbdcf65be94a0f1d0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 5152, "upload_time": "2019-10-27T14:57:54", "upload_time_iso_8601": "2019-10-27T14:57:54.165877Z", "url": "https://files.pythonhosted.org/packages/8b/a5/b14f32a15434eff6fb52aaf5d0da0e055be1a11f0adb08fb65953ec8b9f7/pgsql-1.2.tar.gz", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "18455695b71b7e9dbdcf65be94a0f1d0", "sha256": "b11b86d2b46fcd8cbfa3d11f970ed92d6ee699f825f1aa5d2ea301a6e30f04f6" }, "downloads": -1, "filename": "pgsql-1.2.tar.gz", "has_sig": false, "md5_digest": "18455695b71b7e9dbdcf65be94a0f1d0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 5152, "upload_time": "2019-10-27T14:57:54", "upload_time_iso_8601": "2019-10-27T14:57:54.165877Z", "url": "https://files.pythonhosted.org/packages/8b/a5/b14f32a15434eff6fb52aaf5d0da0e055be1a11f0adb08fb65953ec8b9f7/pgsql-1.2.tar.gz", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }