Skip to main content

Ayncio-based Python client for rqlite.

Project description

This package contains an asynchronous, pure-Python rqlite client library. (based on the official pyrqlite library)

Requirements

  • Python – one of the following:

    • CPython >= 3.6 recommended (>= 3.4 will work, probably)

  • rqlite Server

Example

The following code creates a connection and executes some statements:

import aiorqlite

@aiorqlite.arun
async def main():
        # Connect to the database
        async with aiorqlite.connect(':memory:') as db:
                async with db.cursor() as cursor:
                        await cursor.execute('CREATE TABLE foo (id integer not null primary key, name text)')
                        await cursor.executemany('INSERT INTO foo(name) VALUES(?)', seq_of_parameters=(('a',), ('b',)))

                async with db.cursor() as cursor:
                        # Read a single record with qmark parameter style
                        sql = "SELECT `id`, `name` FROM `foo` WHERE `name`=?"
                        await cursor.execute(sql, ('a',))
                        result = await cursor.fetchone()
                        print(result)
                        # Read a single record with named parameter style
                        sql = "SELECT `id`, `name` FROM `foo` WHERE `name`=:name"
                        await cursor.execute(sql, {'name': 'b'})
                        result = await cursor.fetchone()
                        print(result)

main()

This example will print:

{'id': 1, 'name': 'a'}
{'id': 2, 'name': 'b'}

Paramstyle

Only qmark and named paramstyles (as defined in PEP 249) are supported.

Limitations

Transactions are not supported.

License

pyrqlite (and subsequently aiorqlite) is released under the MIT License. See LICENSE for more information.

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

AIOrqlite-0.2.3.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

AIOrqlite-0.2.3-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file AIOrqlite-0.2.3.tar.gz.

File metadata

  • Download URL: AIOrqlite-0.2.3.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for AIOrqlite-0.2.3.tar.gz
Algorithm Hash digest
SHA256 2499242697ca4faf8476cd685a1ec62d672f76b357b8f2378e0f0603221dc6b3
MD5 fb9f409a2dc886d75edbfa650d260008
BLAKE2b-256 0696ca28a554b7b40476394fce84d8cb53f2efcd6952180985631bed69645197

See more details on using hashes here.

File details

Details for the file AIOrqlite-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: AIOrqlite-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for AIOrqlite-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1765c4fc7b971a5c667c7f153c4c51bae499afed1e2797c14c68342ce42e34f1
MD5 e68353c0a88fdc80953ec0448fdbd7c9
BLAKE2b-256 53ce848640fdb031e7530c532e0f3f30df25cc4019f3f52b1b0a75ada88d65e6

See more details on using hashes here.

Supported by

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