Skip to main content

PostgreSQL integration for taskiq

Project description

taskiq-postgres

PostgreSQL integration for Taskiq.

Installation

Depend on your preferred PostgreSQL driver, you can install this library:

# with asyncpg
pip install taskiq-postgres[asyncpg]

# with psqlpy
pip install taskiq-postgres[psqlpy]

# with aiopg
pip install taskiq-postgres[aiopg]

Usage

Simple example of usage with asyncpg:

# broker.py
import asyncio

from taskiq_pg.asyncpg import AsyncpgResultBackend, AsyncpgBroker

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

broker = AsyncpgBroker(
    dsn="postgres://postgres:postgres@localhost:5432/postgres",
).with_result_backend(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())

Motivation

There are too many libraries for PostgreSQL and Taskiq integration. Although they have different view on interface and different functionality. To address this issue I created this library with a common interface for most popular PostgreSQL drivers that handle similarity across functionality of result backends and brokers.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

taskiq_postgres-0.0.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

taskiq_postgres-0.0.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file taskiq_postgres-0.0.0.tar.gz.

File metadata

  • Download URL: taskiq_postgres-0.0.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.3

File hashes

Hashes for taskiq_postgres-0.0.0.tar.gz
Algorithm Hash digest
SHA256 2a5d832f8faf60d283fa4c1e8eca05fb5bd4ad2207fbb599ea30d90fd21a41f9
MD5 ca0093383399630711f45d1874b68e0f
BLAKE2b-256 47f152a9d7c8ca5ecf0e627f8494d455f5e2e6ef1b5ec4c51ccc1e83bc1cfead

See more details on using hashes here.

File details

Details for the file taskiq_postgres-0.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for taskiq_postgres-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c5563dc901bf21aa77c6136ce9fde2c14d7d8b2886f53f47979a37106ed43b3
MD5 e0c9b6b7be87fdf0b090cc2dcaa5c00b
BLAKE2b-256 6232a426df0913311e594094b36b07814debb7a485e65f12a0fe3df6dc7604c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page