Skip to main content

An asyncio PosgtreSQL driver

Project description

https://travis-ci.org/MagicStack/asyncpg.svg?branch=master https://ci.appveyor.com/api/projects/status/9rwppnxphgc8bqoj/branch/master?svg=true https://img.shields.io/pypi/v/asyncpg.svg

asyncpg is a database interface library designed specifically for PostgreSQL and Python/asyncio. asyncpg is an efficient, clean implementation of PostgreSQL server binary protocol for use with Python’s asyncio framework. You can read more about asyncpg in an introductory blog post.

asyncpg requires Python 3.5 or later and is supported for PostgreSQL versions 9.1 to 9.6.

Documentation

The project documentation can be found here.

Performance

In our testing asyncpg is, on average, 3x faster than psycopg2 (and its asyncio variant – aiopg).

performance.png

The above results are a geometric mean of benchmarks obtained with PostgreSQL client driver benchmarking toolbench.

Features

asyncpg implements PostgreSQL server protocol natively and exposes its features directly, as opposed to hiding them behind a generic facade like DB-API.

This enables asyncpg to have easy-to-use support for:

  • prepared statements

  • scrollable cursors

  • partial iteration on query results

  • automatic encoding and decoding of composite types, arrays, and any combination of those

  • straightforward support for custom data types

Installation

asyncpg is available on PyPI and has no dependencies. Use pip to install:

$ pip install asyncpg

Basic Usage

import asyncio
import asyncpg

async def run():
    conn = await asyncpg.connect(user='user', password='password',
                                 database='database', host='127.0.0.1')
    values = await conn.fetch('''SELECT * FROM mytable''')
    await conn.close()

loop = asyncio.get_event_loop()
loop.run_until_complete(run())

License

asyncpg is developed and distributed under the Apache 2.0 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

asyncpg-0.8.3.tar.gz (405.5 kB view details)

Uploaded Source

Built Distributions

asyncpg-0.8.3-cp36-cp36m-win_amd64.whl (621.6 kB view details)

Uploaded CPython 3.6m Windows x86-64

asyncpg-0.8.3-cp36-cp36m-win32.whl (585.1 kB view details)

Uploaded CPython 3.6m Windows x86

asyncpg-0.8.3-cp36-cp36m-manylinux1_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.6m

asyncpg-0.8.3-cp36-cp36m-manylinux1_i686.whl (1.5 MB view details)

Uploaded CPython 3.6m

asyncpg-0.8.3-cp36-cp36m-macosx_10_11_x86_64.whl (716.8 kB view details)

Uploaded CPython 3.6m macOS 10.11+ x86-64

asyncpg-0.8.3-cp35-cp35m-win_amd64.whl (613.9 kB view details)

Uploaded CPython 3.5m Windows x86-64

asyncpg-0.8.3-cp35-cp35m-win32.whl (579.2 kB view details)

Uploaded CPython 3.5m Windows x86

asyncpg-0.8.3-cp35-cp35m-manylinux1_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.5m

asyncpg-0.8.3-cp35-cp35m-manylinux1_i686.whl (1.4 MB view details)

Uploaded CPython 3.5m

asyncpg-0.8.3-cp35-cp35m-macosx_10_11_x86_64.whl (707.2 kB view details)

Uploaded CPython 3.5m macOS 10.11+ x86-64

File details

Details for the file asyncpg-0.8.3.tar.gz.

File metadata

  • Download URL: asyncpg-0.8.3.tar.gz
  • Upload date:
  • Size: 405.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for asyncpg-0.8.3.tar.gz
Algorithm Hash digest
SHA256 c12ff82c36bce113ff27289d15439e351274be5dcf40e3ecb32a03b77521d856
MD5 6deb29c96a5922b67105f27cdbf562be
BLAKE2b-256 bbc12cd88ab85ad179f07955f4aa0fef4042d65df0a0d69944708bb10505e2f1

See more details on using hashes here.

File details

Details for the file asyncpg-0.8.3-cp36-cp36m-win_amd64.whl.

File metadata

File hashes

Hashes for asyncpg-0.8.3-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 30521614153c9fe7db33cb48086b8ce31472bf31319e648659923670c8d2ff7a
MD5 88eda347a612c5ca09348ff81dbbc91f
BLAKE2b-256 c52f001e98018cf7eb82db10c201a9f0cb2dae1994dd1bdf3b0d3135c981d87f

See more details on using hashes here.

File details

Details for the file asyncpg-0.8.3-cp36-cp36m-win32.whl.

File metadata

File hashes

Hashes for asyncpg-0.8.3-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 f7659aaee13fb5c058132f7562bacd94d07851b208d9aa10bcc4f702bec20db0
MD5 4b3267edc37673cbaeec61576ca9de94
BLAKE2b-256 385a9ef36a04fb84423f55604fa69d73f9c9b2ee12968b6748fcdc67a9410607

See more details on using hashes here.

File details

Details for the file asyncpg-0.8.3-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for asyncpg-0.8.3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 317a4c3d10ef0b7cc837309d461fa65e6d3681cf0d372ba4c7ffa9d5f627e448
MD5 7665fa936dbe7758aa482948a8428135
BLAKE2b-256 f5638cf40e87d173009912ad3133a955a1afb1a0785d0276b70253829747a51b

See more details on using hashes here.

File details

Details for the file asyncpg-0.8.3-cp36-cp36m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for asyncpg-0.8.3-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 c599924505e86a75142fc628684277181a38478473825ad68495138ba4744ebb
MD5 caa380563a8aadcada5f8656410727ec
BLAKE2b-256 525057d3df62672328f35d767c4a84460eb1b8a1837b9ae232069d1e3c16dddf

See more details on using hashes here.

File details

Details for the file asyncpg-0.8.3-cp36-cp36m-macosx_10_11_x86_64.whl.

File metadata

File hashes

Hashes for asyncpg-0.8.3-cp36-cp36m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 86415c836e6e844aa7667bffc430c0db168489e190eb6f49d5518dc4548fb3ce
MD5 ce92ac61610fd14883396842e3f8ef41
BLAKE2b-256 f5e488b3b9180c697dc00f10077c8a785b8ec00889ef410c68cd0efdfc218825

See more details on using hashes here.

File details

Details for the file asyncpg-0.8.3-cp35-cp35m-win_amd64.whl.

File metadata

File hashes

Hashes for asyncpg-0.8.3-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 ee26268b7d29e02f33792ce4b1d196c3de630ae4bc6c77ed61105c02472573a9
MD5 5a60123f35690ba6f709d2bbe4af28bd
BLAKE2b-256 8fbf62f4cc268b86053b6cf8c1c09d16c1631013655a06a7d724226e58a71833

See more details on using hashes here.

File details

Details for the file asyncpg-0.8.3-cp35-cp35m-win32.whl.

File metadata

File hashes

Hashes for asyncpg-0.8.3-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 d3210b2fa84da78c6128ca24bfd16b37b146516a8b1cbdf08746f38d6561764a
MD5 d3ef7e628bb74950761d6544ef60a9a5
BLAKE2b-256 bd8c23e55234dd9781d55b2683a8e0f5908d22e3154c33485cd4bea0b76497f9

See more details on using hashes here.

File details

Details for the file asyncpg-0.8.3-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for asyncpg-0.8.3-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c96e04ebb34b36993c23d157867c0454680d102f700c67a0a5fd96995065c590
MD5 287083ccb71e5f94590cb9f055bd953f
BLAKE2b-256 08f0b25703c6ed271e8fda47f3e1be9f9fc77d875f54e5de48b6cb675d56ede0

See more details on using hashes here.

File details

Details for the file asyncpg-0.8.3-cp35-cp35m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for asyncpg-0.8.3-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 bffbd867f89d801edd71329222e5ae087058aa5fcafd005d07440e1c6285f5a6
MD5 f061753bc0cea5089dfb0b473f0c0059
BLAKE2b-256 43bf00508a9254053f8fe3de0aba6aac257bfb9481780f9fb228816db4c81a85

See more details on using hashes here.

File details

Details for the file asyncpg-0.8.3-cp35-cp35m-macosx_10_11_x86_64.whl.

File metadata

File hashes

Hashes for asyncpg-0.8.3-cp35-cp35m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 280866728b779909c9a1598b9a5454590eb4251aa7a7c9b9c5b3ca932bcc8797
MD5 c233aad040d167ea948865346785edc1
BLAKE2b-256 0613561ca31c3b69ce67353e99dfa4ea33048e4465ab6b9cd2556575125cbddb

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