Skip to content

Async Python client for dqlite, following asyncpg patterns.

License

Notifications You must be signed in to change notification settings

letsdiscodev/python-dqlite-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Async Python client for dqlite, following asyncpg patterns.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages