Skip to main content

Async Python client for dqlite with connection pooling and leader detection

Project description

dqlite-client

Async Python client for dqlite, following asyncpg patterns.

Installation

pip install dqlite-client

Usage

import asyncio
from dqliteclient import connect

async def main():
    conn = await connect("localhost:9001")
    async with conn.transaction():
        await conn.execute("CREATE TABLE IF NOT EXISTS test (id INTEGER PRIMARY KEY, name TEXT)")
        await conn.execute("INSERT INTO test (name) VALUES (?)", ["hello"])
        rows = await conn.fetch("SELECT * FROM test")
        for row in rows:
            print(row)
    await conn.close()

asyncio.run(main())

Connection Pooling

from dqliteclient import create_pool

pool = await create_pool(["localhost:9001", "localhost:9002", "localhost:9003"])
async with pool.acquire() as conn:
    rows = await conn.fetch("SELECT 1")

Development

See DEVELOPMENT.md for setup and contribution guidelines.

License

MIT

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

dqlite_client-0.1.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

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

dqlite_client-0.1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dqlite_client-0.1.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dqlite_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 da58cf889e568edd65289784559a8b6229787d3b1a9e914f7d0ab00bbb1fcd91
MD5 0cfac519a4001bae7e1c393dba150d44
BLAKE2b-256 f105cd674b38e924f491b4f3f5f3a61aaf9bac6ecb8c5b4db453e63d1b62c45c

See more details on using hashes here.

Provenance

The following attestation bundles were made for dqlite_client-0.1.0.tar.gz:

Publisher: publish-to-pypi.yml on letsdiscodev/python-dqlite-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: dqlite_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dqlite_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6551631c7e1cc60cb39ff2aadadebbd92c0b196fca32a3ce5d270bfc0fd8364a
MD5 808c3f4fa8ad7dc204f1819b0b08668b
BLAKE2b-256 edd6c5dc3558e13cf11f88ec4cfec3666ae67e093a5329aeaf7f54a98c41eaea

See more details on using hashes here.

Provenance

The following attestation bundles were made for dqlite_client-0.1.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on letsdiscodev/python-dqlite-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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