Skip to main content

Async Support for various databases

Project description

AIO-Databases

The package gives you asycio support for a range of databases (SQLite, PostgreSQL, MySQL).

Tests Status PYPI Version Python Versions

Requirements

  • python >= 3.7

Installation

aio-databases should be installed using pip:

$ pip install aio-databases

You can install the required database drivers with:

$ pip install aio-databases[sqlite]
$ pip install aio-databases[postgresql]
$ pip install aio-databases[mysql]

Usage

    from aio_databases import Database

    db = Database('sqlite:///:memory:')

    await db.execute('select $1', '1')
    await db.executemany('select $1', '1', '2', '3')

    res = await db.fetchall('select (2 * $1) res', 2)
    assert res == [(4,)]

    res = await db.fetchone('select (2 * $1) res', 2)
    assert res == (4,)
    assert isinstance(res, db.backend.record_cls)

    res = await db.fetchval('select 2 * $1', 2)
    assert res == 4

Bug tracker

If you have any suggestions, bug reports or annoyances please report them to the issue tracker at https://github.com/klen/aio-databases/issues

Contributing

Development of the project happens at: https://github.com/klen/aio-databases

License

Licensed under a MIT License

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

aio-databases-0.0.11.tar.gz (6.9 kB view hashes)

Uploaded Source

Built Distribution

aio_databases-0.0.11-py3-none-any.whl (8.2 kB view hashes)

Uploaded Python 3

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