{ "info": { "author": "Shawn Wallis", "author_email": "shawn.p.wallis@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Database", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "#################\npsycopg2-pgevents\n#################\n\n.. image:: https://circleci.com/gh/shawalli/psycopg2-pgevents.svg?style=svg\n :target: https://circleci.com/gh/shawalli/psycopg2-pgevents\n.. image:: https://coveralls.io/repos/github/shawalli/psycopg2-pgevents/badge.svg?branch=master\n :target: https://coveralls.io/github/shawalli/psycopg2-pgevents?branch=master\n.. image:: https://img.shields.io/badge/License-MIT-yellow.svg\n :target: https://opensource.org/licenses/MIT\n\nThis package makes it simple to use PostGreSQL's NOTIFY/LISTEN eventing system\nfrom Python in a consistent, pleasing manner.\n\nNote that this project officially supports Python 3.6+. This is primarily due\nto static typing.\n\n*******\nExample\n*******\n\nThe following shows an example of the package in action.\n\nAssumptions\n-----------\n\n - PostGreSQL server is running locally.\n - default database (``postgres``) is available.\n - table exists in database in the public schema with the name ``orders``.\n\n.. code-block:: python\n\n from psycopg2 import connect\n from psycopg2_pgevents.trigger import install_trigger, \\\n install_trigger_function, uninstall_trigger, uninstall_trigger_function\n from psycopg2_pgevents.event import poll, register_event_channel, \\\n unregister_event_channel\n\n connection = connect(dsn='postgres:///postgres')\n connection.autocommit = True\n\n install_trigger_function(connection)\n install_trigger(connection, 'orders')\n register_event_channel(connection)\n\n try:\n print('Listening for events...')\n while True:\n for evt in poll(connection):\n print('New Event: {}'.format(evt))\n except KeyboardInterrupt:\n print('User exit via Ctrl-C; Shutting down...')\n unregister_event_channel(connection)\n uninstall_trigger(connection, 'orders')\n uninstall_trigger_function(connection)\n print('Shutdown complete.')\n\n***************\nTroubleshooting\n***************\n\n* The connection's ``autocommit`` property must be enabled for this package to\n operate correctly. This requirement is provided by PostGreSQL's NOTIFY/LISTEN\n mechanism.\n\n* The same connection that is used with ``register_event_channel()`` must be\n used with ``poll()`` in order to receive events. This is due to the nature of\n how PostGreSQL manages \"listening\" connections.\n\n* If the table that you'd like to listen to is not in the public schema, the\n schema name must be given as a keyword argument in the ``install_trigger()``\n method.\n\n**********************\nAuthorship and License\n**********************\n\nWritten by Shawn Wallis and distributed under the MIT license.", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/shawalli/psycopg2-pgevents", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "psycopg2-pgevents", "package_url": "https://pypi.org/project/psycopg2-pgevents/", "platform": "any", "project_url": "https://pypi.org/project/psycopg2-pgevents/", "project_urls": { "Homepage": "https://github.com/shawalli/psycopg2-pgevents" }, "release_url": "https://pypi.org/project/psycopg2-pgevents/0.1.1/", "requires_dist": null, "requires_python": "", "summary": "PostGreSQL LISTEN/NOTIFY functionality, via psycopg2.", "version": "0.1.1" }, "last_serial": 4275365, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "a651efe523fd618860ca1cad947cfa5f", "sha256": "bad81c2b52081169f98d6c4353b2d0c4944b5fabcb70c0d0753c96f6c933aefd" }, "downloads": -1, "filename": "psycopg2-pgevents-0.1.0.tar.gz", "has_sig": false, "md5_digest": "a651efe523fd618860ca1cad947cfa5f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9145, "upload_time": "2018-09-11T10:57:40", "url": "https://files.pythonhosted.org/packages/d7/d4/7a262096c319d9ab20225806da114b93b03b810dffece9fcbf8c02746d02/psycopg2-pgevents-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "4c6f74d4776a412b3d91ee480b89e7ba", "sha256": "f0f1ac536863dceee02e7be677401f02ae96f21b4088aebf4f4a94a86983525f" }, "downloads": -1, "filename": "psycopg2_pgevents-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "4c6f74d4776a412b3d91ee480b89e7ba", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9725, "upload_time": "2018-09-15T18:43:02", "url": "https://files.pythonhosted.org/packages/5a/bf/b1fec09f772d8b2bf8d9f3c7e11f29bc2ea732ce4a74ed2f5f9cebaece01/psycopg2_pgevents-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7bf01d2908413ea6dc4b5e3e20ae4a12", "sha256": "ee73068e22e66cc4c5fa8fcfb5b5ca0da6879f203c3b43aab4786f96c1975e0e" }, "downloads": -1, "filename": "psycopg2-pgevents-0.1.1.tar.gz", "has_sig": false, "md5_digest": "7bf01d2908413ea6dc4b5e3e20ae4a12", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9170, "upload_time": "2018-09-15T18:12:50", "url": "https://files.pythonhosted.org/packages/f1/a5/fee64c8e0c2fc4a2f2de31b5679dd7c04b2c135db6d4e9ada4d527fdc3d1/psycopg2-pgevents-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4c6f74d4776a412b3d91ee480b89e7ba", "sha256": "f0f1ac536863dceee02e7be677401f02ae96f21b4088aebf4f4a94a86983525f" }, "downloads": -1, "filename": "psycopg2_pgevents-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "4c6f74d4776a412b3d91ee480b89e7ba", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9725, "upload_time": "2018-09-15T18:43:02", "url": "https://files.pythonhosted.org/packages/5a/bf/b1fec09f772d8b2bf8d9f3c7e11f29bc2ea732ce4a74ed2f5f9cebaece01/psycopg2_pgevents-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7bf01d2908413ea6dc4b5e3e20ae4a12", "sha256": "ee73068e22e66cc4c5fa8fcfb5b5ca0da6879f203c3b43aab4786f96c1975e0e" }, "downloads": -1, "filename": "psycopg2-pgevents-0.1.1.tar.gz", "has_sig": false, "md5_digest": "7bf01d2908413ea6dc4b5e3e20ae4a12", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9170, "upload_time": "2018-09-15T18:12:50", "url": "https://files.pythonhosted.org/packages/f1/a5/fee64c8e0c2fc4a2f2de31b5679dd7c04b2c135db6d4e9ada4d527fdc3d1/psycopg2-pgevents-0.1.1.tar.gz" } ] }