Skip to main content

SQLAlchemy integration for taskiq

Project description

TaskIQ - SQLAlchemy

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

The broker uses polling to fetch messages.

Usage

import asyncio

from taskiq_sqlalchemy import SQLAlchemyBroker, SQLAlchemyResultBackend

# can be a sqlalchemy async compatible connection string or a sqlalchemy AsyncEngine instance
connection_string = "sqlite+aiosqlite:///tasks.db"


result_backend = SQLAlchemyResultBackend(connection_string)

broker = SQLAlchemyBroker(connection_string).with_result_backend(result_backend)

@broker.task()
async def my_add_task(a:int|float, b:int|float) -> int|float:
    await asyncio.sleep(1)
    return a + b

async def main():
    await broker.startup()
    task = await my_add_task.kiq(1, 1)
    result = await task.wait_result()
    print(result)


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

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_sqlalchemy-0.1.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

taskiq_sqlalchemy-0.1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file taskiq_sqlalchemy-0.1.0.tar.gz.

File metadata

  • Download URL: taskiq_sqlalchemy-0.1.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for taskiq_sqlalchemy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 caedb500d5c4456ad19e4f103c7859de3698ba85496ae3ea9c37ee6643a180ae
MD5 961ccc9a6a28d57552c5038c79dd3afa
BLAKE2b-256 964fbebc915496063cccd720fb2da15e72a2ba1d90609cf121c3d1cb84a0a4e8

See more details on using hashes here.

File details

Details for the file taskiq_sqlalchemy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: taskiq_sqlalchemy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for taskiq_sqlalchemy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 82c1236b8ad7e298612e4e7dd82bebe376b0492d6191e17c052b273f9befd735
MD5 23f04f580820ce28bcb3b06ff0236104
BLAKE2b-256 346333756a438bb99de6ef710cc51bb060bf323816dc7103415f69cd2f85213e

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