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.2 to 10.

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.16.0.tar.gz (615.1 kB view details)

Uploaded Source

Built Distributions

asyncpg-0.16.0-cp36-cp36m-win_amd64.whl (900.0 kB view details)

Uploaded CPython 3.6m Windows x86-64

asyncpg-0.16.0-cp36-cp36m-win32.whl (844.1 kB view details)

Uploaded CPython 3.6m Windows x86

asyncpg-0.16.0-cp36-cp36m-manylinux1_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.6m

asyncpg-0.16.0-cp36-cp36m-manylinux1_i686.whl (2.2 MB view details)

Uploaded CPython 3.6m

asyncpg-0.16.0-cp36-cp36m-macosx_10_12_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.6m macOS 10.12+ x86-64

asyncpg-0.16.0-cp35-cp35m-win_amd64.whl (889.8 kB view details)

Uploaded CPython 3.5m Windows x86-64

asyncpg-0.16.0-cp35-cp35m-win32.whl (836.3 kB view details)

Uploaded CPython 3.5m Windows x86

asyncpg-0.16.0-cp35-cp35m-manylinux1_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.5m

asyncpg-0.16.0-cp35-cp35m-manylinux1_i686.whl (2.1 MB view details)

Uploaded CPython 3.5m

asyncpg-0.16.0-cp35-cp35m-macosx_10_12_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.5m macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for asyncpg-0.16.0.tar.gz
Algorithm Hash digest
SHA256 31d5a9d993ce97924d9601bf6a37bb8b542d63bc8716b36238511e5e5915b14c
MD5 5f04fcf976ca98a42df7ba7d187daf8e
BLAKE2b-256 89626d218bc7d1412b837ed6f006a42a660fc970c3135c22c55f2370a93e11d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.16.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 d201b4851a39c1f2303d99f4199974d8e01d48cec7512b59e532979ba6277def
MD5 f4614af30c7dc8c19fee507db5ee8d80
BLAKE2b-256 599f16cd171edfc60598035360eb91a24bf205d71654a6042038d594267ffbdf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.16.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 600e6e14078be26e2322dfded808af55248301633592a27337b192ca2137bf04
MD5 ff0319b9171ffb3cef06bcbfb2ecc01c
BLAKE2b-256 ca59736d2e079606b8f2309aec1fd43a5aef162c4756fdfecb99316a3a9eca95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.16.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e0387c4a584394997335375e897b9d63a7a31a1c77482d8b94f9a1be77bcfd08
MD5 e330c9b01605e31b4b9d53a7964699b5
BLAKE2b-256 c3927d6c546df71d628695bc5b0ac32643d1a78548ac3e2e60a24c255a8f08f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.16.0-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 166c8e094de78ccbfc598a5342037a6ca5d7ee1e8144b3cfade244dd591b1ed0
MD5 cb0fe83ea268257785901e8a8b750bd2
BLAKE2b-256 8f5146c58c43b7eb58f62a6048a79ab6cc5a714eb30c92f270c4175143472758

See more details on using hashes here.

File details

Details for the file asyncpg-0.16.0-cp36-cp36m-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for asyncpg-0.16.0-cp36-cp36m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 cca8de381ffca375dd7cbf13f918dd68ca493e9082e7fe3f5827c08e3cfd2432
MD5 9447cb18349753f62a473fc9598cb19d
BLAKE2b-256 df2562cdaa3808c9ea74c29522b9fce2dad662bf1fa89fd45ca99a03b06e6091

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.16.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 e6755dd3318c0b170d4727db0e310c26e569faa101c7506b6a3e041f16ef8df9
MD5 ad21d8f3a6bff0eb4ef34b022614f8af
BLAKE2b-256 3d61bd570e08a4f577eb0bb2b8a27b9917db9ab28c443d511457ac8db76e93ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.16.0-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 2913b7cffdfb5bf1da5ed751485b559d1f1990be005d6d63d3ca0bf09a9d8ee6
MD5 cef2030c43cd7095d40f6d052d2c3cfe
BLAKE2b-256 e21bba6a42a7855532fb45c7f98ba6e4c6fd94b7e177b72d50a7e44799d4f36b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.16.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5791554375c71ef339ee01fafb931f593c9f3ec85a5db9753c185199cee6c87e
MD5 b34c51a238ce21b220d2200d531b7950
BLAKE2b-256 0ac85a299669ce9844b3448339e9426c21b8434fe3bb0f25a1827e4c7c55b941

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.16.0-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 440dc17ec98c2e69f58947a591eed5967724794c876b1d6e53950e9b0b561788
MD5 4a912ccae47a1d8f7103fd539be0283b
BLAKE2b-256 8a6690b6f0875fa862baee51a7c73051996e969150a8b6084542acac12701602

See more details on using hashes here.

File details

Details for the file asyncpg-0.16.0-cp35-cp35m-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for asyncpg-0.16.0-cp35-cp35m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d70fee2708e538a7333bca94170da8ab9233e5eae136143e2275f7b2d9bb4c24
MD5 59d764157b3ed4fdfeb62e643ad8a923
BLAKE2b-256 f6799530b7e665acadbc1c153358e94ec4c0c3628af223c25bc3a30fc0538fa5

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