{ "info": { "author": "Danilchenko Maksim", "author_email": "dmax.dev@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3.6" ], "description": "Python async api for creating and managing queues in postgres\n\n[![Travis CI](https://travis-ci.org/maximdanilchenko/async-pq.svg?branch=master)](https://travis-ci.org/maximdanilchenko/async-pq)\n[![PyPI version](https://badge.fury.io/py/async-pq.svg)](https://badge.fury.io/py/async-pq)\n[![Documentation Status](https://readthedocs.org/projects/async-pq/badge/?version=latest)](https://async-pq.readthedocs.io/en/latest/?badge=latest)\n[![codecov](https://codecov.io/gh/maximdanilchenko/async-pq/branch/master/graph/badge.svg)](https://codecov.io/gh/maximdanilchenko/async-pq)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n\nPostgres is not best solution for storing and managing queues, \nbut sometimes we have no choice.\n\n```async-pq``` can work with millions of entities and thousands of \nrequests in one queue. Is used in production. So its well tested and stable.\n\n## Install\n```\n> pip install async-pq\n```\n\n## Quick start\n\nTo work with ```async-pq``` we need ```asyncpg``` library:\n```python\nimport asyncpg\n\nconn = await asyncpg.connect('postgresql://postgres@localhost/test')\n```\n\n```QueueFabric.find_queue``` method will create needed \ntables (one for requests and one for messages) in database if it is new queue. \nAlso it has ```is_exists_queue``` method for situations when you \nneed to know that it is exists or not and will be the new queue.\n```python\nfrom async_pq import Queue, QueueFabric\n\nqueue: Queue = await QueueFabric(conn).find_queue('items')\n```\n## Operations with queue\nPut new items (should be dumped JSONs) in queue:\n```python\nawait queue.put('{\"id\":1,\"data\":[1,2,3]}', '{\"id\":2,\"data\":[3,2,6]}')\n```\n\nPop items from queue with some ```limit```. \nIt will create one request and return its id. \nIt is useful when you want to use acknowledgement pattern:\n```python\n# If with_ack=False (default from > 0.2.1), massage will be acknowledged in place automatically\nrequest_id, data = await queue.pop(limit=2, with_ack=True)\n```\n\nTo acknowledge request use ```ack``` method:\n```python\n# returns False if request does not found or acked already\nis_acked: bool = await queue.ack(request_id)\n```\n\nOr vice versa:\n```python\n# returns False if request does not found or acked already\nis_unacked: bool = await queue.unack(request_id)\n```\n\nYou can return unacknowledged massages older than ```timeout``` seconds \n(default limit=1000 requests) to queue:\n```python\nrequests_number = await queue.return_unacked(timeout=300, limit=500)\n```\n\nClean queue (delete acknowledged massages) to not overfill database with old data \n(default limit= messages of 1000 requests):\n```python\nrequests_number = await queue.clean_acked_queue(limit=500)\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/maximdanilchenko/async-pq", "keywords": "async postgresql asyncpg queue", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "async-pq", "package_url": "https://pypi.org/project/async-pq/", "platform": "", "project_url": "https://pypi.org/project/async-pq/", "project_urls": { "Homepage": "https://github.com/maximdanilchenko/async-pq" }, "release_url": "https://pypi.org/project/async-pq/0.3.1/", "requires_dist": [ "asyncpg" ], "requires_python": "", "summary": "Python async api for creating and managing queues in postgres", "version": "0.3.1" }, "last_serial": 4394210, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "5f1625f579ce176103a8c9520e016539", "sha256": "105a1af209be64d40d7c51c5bd8a3c993642d525dd05869fefa5d29f9a9997a1" }, "downloads": -1, "filename": "async_pq-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "5f1625f579ce176103a8c9520e016539", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3510, "upload_time": "2018-08-08T15:49:09", "url": "https://files.pythonhosted.org/packages/a2/a5/e505fb0b1d2c05795d8a0e9478bee8c00385c763ed6d16e3e02c19ac1444/async_pq-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a8e8dc40a64723e131ed869f4575e066", "sha256": "661cba65c191cc4be918c94455be1f92218151c8bb95116df13da00696ae76ba" }, "downloads": -1, "filename": "async-pq-0.1.0.tar.gz", "has_sig": false, "md5_digest": "a8e8dc40a64723e131ed869f4575e066", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3303, "upload_time": "2018-08-08T15:49:10", "url": "https://files.pythonhosted.org/packages/1b/92/a90a1e1beffb206ed5d5fa1c56b8b25c8c2b2422cc73cb5acfdc55ba9934/async-pq-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "fd11ef8f124a2e7bc75c36b7be2cf035", "sha256": "30bfaf8e390ac58092d7701742c71d8900fce2caaaf217a231fe09751f18fb0f" }, "downloads": -1, "filename": "async_pq-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "fd11ef8f124a2e7bc75c36b7be2cf035", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3730, "upload_time": "2018-08-09T15:56:16", "url": "https://files.pythonhosted.org/packages/15/36/6f989015b8a80456b626dc4e57de8cb84d6a873bfba250b0088220bd2f2e/async_pq-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1cb99ecca2877948d7990abb1c67f59a", "sha256": "d9ec127501658c9b94b24b2da455ba10aa2511951b7e7e0cebc7226cec8a6f19" }, "downloads": -1, "filename": "async-pq-0.2.0.tar.gz", "has_sig": false, "md5_digest": "1cb99ecca2877948d7990abb1c67f59a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3532, "upload_time": "2018-08-09T15:56:17", "url": "https://files.pythonhosted.org/packages/f1/b3/def750370d634fec7ef3929e5f136a1ce14e8b940b8dec75528bfc3ab819/async-pq-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "a40b2d6872e44d38d72a6f94321129d4", "sha256": "dcf5a5e9b2a7132aa5cc77cb4b4b5aaa985bf290d5975e7b15ff85a879df6a43" }, "downloads": -1, "filename": "async_pq-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "a40b2d6872e44d38d72a6f94321129d4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3736, "upload_time": "2018-08-10T10:26:31", "url": "https://files.pythonhosted.org/packages/5b/12/6925bb68b29b2ea819953da508b006f8d719bc6710ca9444be2d2296266d/async_pq-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "493dd219ceed727e2e853f35a7df6656", "sha256": "2a63e09a6402426d6e5a750d91795c237b7c8065530935b03770366c22e3bed5" }, "downloads": -1, "filename": "async-pq-0.2.1.tar.gz", "has_sig": false, "md5_digest": "493dd219ceed727e2e853f35a7df6656", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3543, "upload_time": "2018-08-10T10:26:33", "url": "https://files.pythonhosted.org/packages/2d/7c/a974939672a9b7cdd41bfcff76cc2190653422c3b885c20d426108ff7916/async-pq-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "c5024c5c28fccd78078989241bcf3079", "sha256": "becbb5d3f81888958317a963a54e223d090760a49181b5e512cc5ec1f3e8dd16" }, "downloads": -1, "filename": "async_pq-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "c5024c5c28fccd78078989241bcf3079", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3904, "upload_time": "2018-10-15T10:15:45", "url": "https://files.pythonhosted.org/packages/61/0a/559c42c536762b7177d1c007e6c51ad5a00d3cea7ed1478486883c416ae2/async_pq-0.2.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fc069667bd1aaf7188c56c8d30a90fb5", "sha256": "e615b66647493fb445e3012e43e2decfe6b5402e4e219423b9c3ae89dabf3ace" }, "downloads": -1, "filename": "async-pq-0.2.2.tar.gz", "has_sig": false, "md5_digest": "fc069667bd1aaf7188c56c8d30a90fb5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3549, "upload_time": "2018-10-15T10:15:47", "url": "https://files.pythonhosted.org/packages/4f/0b/1f2674daee4af54e546f5b207ed3dff56c786eef1623f48f6d686582cf77/async-pq-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "93b319da1dc19496bc2edf3c202e9cc9", "sha256": "e819ad3eecf16e1a8557dde960acc706f42fba87f726afecfd819259fb887c75" }, "downloads": -1, "filename": "async_pq-0.2.3-py3-none-any.whl", "has_sig": false, "md5_digest": "93b319da1dc19496bc2edf3c202e9cc9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3901, "upload_time": "2018-10-15T10:51:54", "url": "https://files.pythonhosted.org/packages/e8/d7/94d39edfb81aec678d4b79d1303fc98bb66ace2242f704f28a88f2f60e8f/async_pq-0.2.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0dbba0240ef7209c13d2002a20c625f5", "sha256": "eff9aa69526646bd3fb61d456fc4518db9bdcadfa28ec9554ed571f4233b7c80" }, "downloads": -1, "filename": "async-pq-0.2.3.tar.gz", "has_sig": false, "md5_digest": "0dbba0240ef7209c13d2002a20c625f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3547, "upload_time": "2018-10-15T10:51:55", "url": "https://files.pythonhosted.org/packages/7d/16/ccee6a8982d38030e23ae121f0afc91e6a11ec40a4e43a89890dde808759/async-pq-0.2.3.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "c524a36dcd534877f31f3ecef3e5af7e", "sha256": "073616d0a5557ba11c85cbc37d532744a6c533e6938eb7828375b99d1fb3a907" }, "downloads": -1, "filename": "async_pq-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "c524a36dcd534877f31f3ecef3e5af7e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3962, "upload_time": "2018-10-15T13:28:08", "url": "https://files.pythonhosted.org/packages/5f/ef/26b2b3cc672e206d6f9f9172df0593476ae171280d7dd1b3584512b6a90c/async_pq-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0578b1bd68b935e9ba76af4104e2b24e", "sha256": "04461f0627ea9413503f02f13445d290d763ecec27daa02c356c82b0fd041f78" }, "downloads": -1, "filename": "async-pq-0.3.0.tar.gz", "has_sig": false, "md5_digest": "0578b1bd68b935e9ba76af4104e2b24e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3607, "upload_time": "2018-10-15T13:28:10", "url": "https://files.pythonhosted.org/packages/a2/44/f8999c56a42fe01d3b0f9fbb635b02bd275e4d8083257221b2d0ee06e884/async-pq-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "f8758d368c9e1b40b57bd4ab5f2e7264", "sha256": "a94a54a7fc0ff398fe88d861cc7ec512a4dca1ef6689d564646bdf44e4417612" }, "downloads": -1, "filename": "async_pq-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "f8758d368c9e1b40b57bd4ab5f2e7264", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4278, "upload_time": "2018-10-19T13:29:46", "url": "https://files.pythonhosted.org/packages/f7/42/366cf2b5d4b323cca3ce5d99407b42beeaa896ec07b6f42650a86dbe70d5/async_pq-0.3.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d594d72d0f5d4bc466482aa13c58f752", "sha256": "d4fbeaa3ebae4d1477063f5687c51ecf53b78f7ce9d36b2115e194478e828d81" }, "downloads": -1, "filename": "async-pq-0.3.1.tar.gz", "has_sig": false, "md5_digest": "d594d72d0f5d4bc466482aa13c58f752", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3934, "upload_time": "2018-10-19T13:29:47", "url": "https://files.pythonhosted.org/packages/1f/36/cc3a3dc83523385a0f15e6b369d55297a3d47054a71b4777cee012b6b489/async-pq-0.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f8758d368c9e1b40b57bd4ab5f2e7264", "sha256": "a94a54a7fc0ff398fe88d861cc7ec512a4dca1ef6689d564646bdf44e4417612" }, "downloads": -1, "filename": "async_pq-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "f8758d368c9e1b40b57bd4ab5f2e7264", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4278, "upload_time": "2018-10-19T13:29:46", "url": "https://files.pythonhosted.org/packages/f7/42/366cf2b5d4b323cca3ce5d99407b42beeaa896ec07b6f42650a86dbe70d5/async_pq-0.3.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d594d72d0f5d4bc466482aa13c58f752", "sha256": "d4fbeaa3ebae4d1477063f5687c51ecf53b78f7ce9d36b2115e194478e828d81" }, "downloads": -1, "filename": "async-pq-0.3.1.tar.gz", "has_sig": false, "md5_digest": "d594d72d0f5d4bc466482aa13c58f752", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3934, "upload_time": "2018-10-19T13:29:47", "url": "https://files.pythonhosted.org/packages/1f/36/cc3a3dc83523385a0f15e6b369d55297a3d47054a71b4777cee012b6b489/async-pq-0.3.1.tar.gz" } ] }