Skip to main content

PyPI version PyPI - Downloads License: MIT

anyio-cysqlite

A Bidning for cysqlite that makes the database asynchronous with any asynchronous library that can be binded to anyio meaning that it will work with many server implementations and applications including FastAPI, Starlette and Litestar to name a few server libraries.

from anyio_cysqlite import connect


async def main():
    async with await connect("cysqlite.db") as db:
        await db.execute("create table IF NOT EXISTS data (k, v)")

        async with db.atomic():
            await db.executemany(
                "insert into data (k, v) values (?, ?)",
                [(f"k{i:02d}", f"v{i:02d}") for i in range(10)],
            )
            print(await db.last_insert_rowid())  # 10.

        curs = await db.execute("select * from data")
        async for row in curs:
            print(row)  # e.g., ('k00', 'v00')

        # We can use named parameters with a dict as well.
        row = await db.execute_one(
            "select * from data where k = :key and v = :val",
            {"key": "k05", "val": "v05"},
        )
        print(row)  # ('k05', 'v05')

        await db.close()


if __name__ == "__main__":
    import anyio

    anyio.run(main)

Updated functionality is better

When it comes to database execution updated functionality normally results in better performance such as providing wrappers for atomic, transaction, and savepoint functions which the standard sqlite3 library doesn't currently have. Instead of having a completely seperate thread for the database all operations are done using the anyio's CapacityLimiter and run_sync making the database less resource heavy.

Batteries included

Unlike cysqlite (As of currently), this library retains access to typehints right out of the box making the library less of a function and attribute guessing game.

Download files

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

Source Distribution

anyio_cysqlite-0.3.0.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

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

anyio_cysqlite-0.3.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file anyio_cysqlite-0.3.0.tar.gz.

File metadata

  • Download URL: anyio_cysqlite-0.3.0.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for anyio_cysqlite-0.3.0.tar.gz
Algorithm Hash digest
SHA256 46464f7192f3f6d0503898973aac4a3a73de681f7f03e45ad212cb526513ecab
MD5 69f6300dd95f77b8410fbd30e4c29ece
BLAKE2b-256 5f23b886de8f84c13b79f0d1c61fb5b16537c04cbbe4730fe60def83f7d30683

See more details on using hashes here.

Provenance

The following attestation bundles were made for anyio_cysqlite-0.3.0.tar.gz:

Publisher: python-publish.yml on Vizonex/anyio-cysqlite

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

File details

Details for the file anyio_cysqlite-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: anyio_cysqlite-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for anyio_cysqlite-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4616c0edc430ab3a638cb0481bd048a911a061695c3b711a6732b6f7ea07eeb5
MD5 dcfe43be04cd0862a659f91dc43f2974
BLAKE2b-256 f58152668ce1dc0480284c9c1cf3bb048c7e320ecc27bdfb3e133c3e2736d664

See more details on using hashes here.

Provenance

The following attestation bundles were made for anyio_cysqlite-0.3.0-py3-none-any.whl:

Publisher: python-publish.yml on Vizonex/anyio-cysqlite

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

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.2.0

2 files

0.1.0

2 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