Skip to main content

TaskIQ - PSQLPy

TaskIQ-PSQLPy is a plugin for taskiq that adds a new result backend based on PostgreSQL and PSQLPy.

Installation

To use this project you must have installed core taskiq library:

pip install taskiq

This project can be installed using pip:

pip install taskiq-psqlpy

Or using poetry:

poetry add taskiq-psqlpy

Usage

Let's see the example with the redis broker and PostgreSQL PSQLPy result backend:

# broker.py
import asyncio

from taskiq_redis import ListQueueBroker
from taskiq_psqlpy import PSQLPyResultBackend

psqlpy_result_backend = PSQLPyResultBackend(
    dsn="postgres://postgres:postgres@localhost:5432/postgres",
)

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


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


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


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

PSQLPyResultBackend 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.
  • **connect_kwargs: additional connection parameters, you can read more about it in PSQLPy repository.

Metadata

Release files for taskiq-psqlpy 0.1.7

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-psqlpy 0.1.7
File Size Uploaded
taskiq_psqlpy-0.1.7.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for taskiq-psqlpy 0.1.7
File Interpreter ABI Platform
taskiq_psqlpy-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 8.9 kB

Release files / taskiq_psqlpy-0.1.7.tar.gz

Download URL taskiq_psqlpy-0.1.7.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
fb23ffb0126fa41a48f62d495e7add3933ccafec8a2339ecfd668eb9b24dbc28
BLAKE2b-256 checksum
How to use checksums
78ea1281d8b3d5c5dca6ee303cb51c942f26eb17608f0d990c4c20946425af43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.4 CPython/3.9.23 Linux/6.11.0-1018-azure

Release files / taskiq_psqlpy-0.1.7-py3-none-any.whl

Download URL taskiq_psqlpy-0.1.7-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e84b677701e25fb810ecdf02acb18f6c581d7ea3e14af16908646d01c49abb0
BLAKE2b-256 checksum
How to use checksums
a81beeccc64dadad1705e3a9c97e5d3381f7ad6f0f9b38f5120f336296217547
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.4 CPython/3.9.23 Linux/6.11.0-1018-azure

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

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