{"id":42015280,"url":"https://github.com/danfimov/taskiq-postgres","last_synced_at":"2026-01-26T03:07:35.770Z","repository":{"id":292648794,"uuid":"981534899","full_name":"danfimov/taskiq-postgres","owner":"danfimov","description":"PostgreSQL integration for Taskiq with support for asyncpg, psycopg, psqlpy and aiopg drivers.","archived":false,"fork":false,"pushed_at":"2026-01-19T16:58:04.000Z","size":4641,"stargazers_count":14,"open_issues_count":4,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-19T22:54:06.903Z","etag":null,"topics":["postgresql","taskiq","taskiq-broker","taskiq-result-backend"],"latest_commit_sha":null,"homepage":"https://danfimov.github.io/taskiq-postgres/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danfimov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-11T10:34:51.000Z","updated_at":"2026-01-19T16:57:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"6cdd9a6c-f1e9-4b7a-929f-95343cdd68f5","html_url":"https://github.com/danfimov/taskiq-postgres","commit_stats":null,"previous_names":["danfimov/taskiq-postgres"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/danfimov/taskiq-postgres","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danfimov%2Ftaskiq-postgres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danfimov%2Ftaskiq-postgres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danfimov%2Ftaskiq-postgres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danfimov%2Ftaskiq-postgres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danfimov","download_url":"https://codeload.github.com/danfimov/taskiq-postgres/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danfimov%2Ftaskiq-postgres/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28765573,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T02:25:41.078Z","status":"ssl_error","status_checked_at":"2026-01-26T02:24:28.809Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["postgresql","taskiq","taskiq-broker","taskiq-result-backend"],"created_at":"2026-01-26T03:07:35.233Z","updated_at":"2026-01-26T03:07:35.763Z","avatar_url":"https://github.com/danfimov.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/taskiq-postgres?style=for-the-badge\u0026logo=python)](https://pypi.org/project/taskiq-postgres/)\n[![PyPI](https://img.shields.io/pypi/v/taskiq-postgres?style=for-the-badge\u0026logo=pypi)](https://pypi.org/project/taskiq-postgres/)\n[![Checks](https://img.shields.io/github/check-runs/danfimov/taskiq-postgres/main?nameFilter=Tests%20(3.12,%2018)\u0026style=for-the-badge)](https://github.com/danfimov/taskiq-postgres)\n\n\u003cdiv align=\"center\"\u003e\n\u003ca href=\"https://github.com/danfimov/taskiq-postgres/\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/danfimov/taskiq-postgres/main/assets/logo.png\" width=400\u003e\u003c/a\u003e\n\u003chr/\u003e\n\u003c/div\u003e\n\nPostgreSQL integration for Taskiq with support for asyncpg, psqlpy, psycopg and aiopg drivers.\n\n## Features\n\n- **PostgreSQL Broker** - high-performance message broker using PostgreSQL LISTEN/NOTIFY;\n- **Result Backend** - persistent task result storage with configurable retention;\n- **Scheduler Source** - cron-like task scheduling with PostgreSQL persistence;\n- **Multiple Drivers** - support for asyncpg, psycopg3, psqlpy and aiopg;\n- **Flexible Configuration** - customizable table names, field types, and connection options;\n- **Multiple Serializers** - support for different serialization methods (Pickle, JSON, etc.).\n\nSee usage guide in [documentation](https://danfimov.github.io/taskiq-postgres/) or explore examples in [separate directory](https://github.com/danfimov/taskiq-postgres/examples).\n\n## Installation\n\nDepending on your preferred PostgreSQL driver, you can install this library with the corresponding extra:\n\n```bash\n# with asyncpg\npip install taskiq-postgres[asyncpg]\n\n# with psqlpy\npip install taskiq-postgres[psqlpy]\n\n# with psycopg3\npip install taskiq-postgres[psycopg]\n\n# with aiopg\npip install taskiq-postgres[aiopg]\n```\n\n## Quick start\n\n### Basic task processing\n\n1. Define your broker with [asyncpg](https://github.com/MagicStack/asyncpg):\n\n  ```python\n  # broker_example.py\n  import asyncio\n  from taskiq_pg.asyncpg import AsyncpgBroker, AsyncpgResultBackend\n\n\n  dsn = \"postgres://taskiq_postgres:look_in_vault@localhost:5432/taskiq_postgres\"\n  broker = AsyncpgBroker(dsn).with_result_backend(AsyncpgResultBackend(dsn))\n\n\n  @broker.task(\"solve_all_problems\")\n  async def best_task_ever() -\u003e None:\n      \"\"\"Solve all problems in the world.\"\"\"\n      await asyncio.sleep(2)\n      print(\"All problems are solved!\")\n\n\n  async def main():\n      await broker.startup()\n      task = await best_task_ever.kiq()\n      print(await task.wait_result())\n      await broker.shutdown()\n\n\n  if __name__ == \"__main__\":\n      asyncio.run(main())\n  ```\n\n2. Start a worker to process tasks (by default taskiq runs two instances of worker):\n\n  ```bash\n  taskiq worker broker_example:broker\n  ```\n\n3. Run `broker_example.py` file to send a task to the worker:\n\n  ```bash\n  python broker_example.py\n  ```\n\nYour experience with other drivers will be pretty similar. Just change the import statement and that's it.\n\n### Task scheduling\n\n1. Define your broker and schedule source:\n\n  ```python\n  # scheduler_example.py\n  import asyncio\n  from taskiq import TaskiqScheduler\n  from taskiq_pg.asyncpg import AsyncpgBroker, AsyncpgScheduleSource\n\n\n  dsn = \"postgres://taskiq_postgres:look_in_vault@localhost:5432/taskiq_postgres\"\n  broker = AsyncpgBroker(dsn)\n  scheduler = TaskiqScheduler(\n      broker=broker,\n      sources=[AsyncpgScheduleSource(\n          dsn=dsn,\n          broker=broker,\n      )],\n  )\n\n\n  @broker.task(\n      task_name=\"solve_all_problems\",\n      schedule=[\n          {\n              \"cron\": \"*/1 * * * *\",  # type: str, either cron or time should be specified.\n              \"cron_offset\": None,  # type: str | None, can be omitted. For example \"Europe/Berlin\".\n              \"time\": None,  # type: datetime | None, either cron or time should be specified.\n              \"args\": [], # type list[Any] | None, can be omitted.\n              \"kwargs\": {}, # type: dict[str, Any] | None, can be omitted.\n              \"labels\": {}, # type: dict[str, Any] | None, can be omitted.\n          },\n      ],\n  )\n  async def best_task_ever() -\u003e None:\n      \"\"\"Solve all problems in the world.\"\"\"\n      await asyncio.sleep(2)\n      print(\"All problems are solved!\")\n\n  ```\n\n2. Start worker processes:\n\n  ```bash\n  taskiq worker scheduler_example:broker\n  ```\n\n3. Run scheduler process:\n\n  ```bash\n  taskiq scheduler scheduler_example:scheduler\n  ```\n\n## Motivation\n\nThere are too many libraries for PostgreSQL and Taskiq integration. Although they have different view on interface and different functionality.\nTo address this issue I created this library with a common interface for most popular PostgreSQL drivers that handle similarity across functionality of result backends, brokers and schedule sources.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanfimov%2Ftaskiq-postgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanfimov%2Ftaskiq-postgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanfimov%2Ftaskiq-postgres/lists"}