Skip to main content

taskiq + aiopg

Python Linters

Plugin for taskiq that adds a new result backend based on PostgreSQL and aiopg.

Installation

This project can be installed using pip/poetry/uv (choose your preferred package manager):

pip install taskiq-aiopg

Usage

Let's see the example with the redis broker and PostgreSQL aiopg result backend (run as is):

# broker.py
import asyncio

import taskiq_redis

from taskiq_aiopg import AiopgResultBackend

result_backend = AiopgResultBackend(
    dsn="postgres://postgres:postgres@localhost:5432/postgres",
)

# Or you can use PubSubBroker if you need broadcasting
broker = taskiq_redis.ListQueueBroker(
    url="redis://localhost:6379",
).with_result_backend(result_backend)


@broker.task(task_name="best_task_ever")
async def best_task_ever() -> None:
    """Solve all problems in the world."""
    print("Start to solve all problems...")
    await asyncio.sleep(2.0)
    print("All problems are solved!")


async def main():
    print("Starting the application")
    await broker.startup()
    task = await best_task_ever.kiq()
    print(await task.wait_result())
    await broker.shutdown()


if __name__ == "__main__":
    asyncio.run(main())

Configuration

  • dsn: connection string to PostgreSQL;
  • keep_results: flag to not remove results from Redis after reading;
  • table_name: name of the table in PostgreSQL to store TaskIQ results;
  • field_for_task_id: type of a field for task_id, you may need it if you want to have length of task_id more than 255 symbols;
  • serializer: type of TaskiqSerializer default is PickleSerializer;
  • **connect_kwargs: additional connection parameters, you can read more about it in aiopg repository.

Metadata

Release files for taskiq-aiopg 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for taskiq-aiopg 0.2.0
File Size Uploaded
taskiq_aiopg-0.2.0.tar.gz 7.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for taskiq-aiopg 0.2.0
File Interpreter ABI Platform
taskiq_aiopg-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 kB

Release files / taskiq_aiopg-0.2.0.tar.gz

Download URL taskiq_aiopg-0.2.0.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2d09080f17a0d86a190090c574e789608624d448496a14eddf445b75a93ccbf3
BLAKE2b-256 checksum
How to use checksums
940c389c524f540eb0f35fe6223ffaf8ddeb4b1f2848a8a3482a192b395bb0e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.6.13

Release files / taskiq_aiopg-0.2.0-py3-none-any.whl

Download URL taskiq_aiopg-0.2.0-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
77a38677230ce0abf265455e4d3a7726900ac01e51edaff14a5599c1e4423c64
BLAKE2b-256 checksum
How to use checksums
c64e6eeaf1b289b5aee76a2080c2f3e57b0496f69eb5c851b0eeff82f8430f25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.6.13

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page