Skip to main content
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.

Release files for asyncpg 0.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asyncpg 0.11.0
File Size Uploaded
asyncpg-0.11.0.tar.gz 486.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for asyncpg 0.11.0
File
asyncpg-0.11.0-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details
asyncpg-0.11.0-cp36-cp36m-win32.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-32 Details
asyncpg-0.11.0-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details
asyncpg-0.11.0-cp36-cp36m-manylinux1_i686.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32 Details
asyncpg-0.11.0-cp36-cp36m-macosx_10_12_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.12+ x86-64 Details
asyncpg-0.11.0-cp35-cp35m-win_amd64.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-64 Details
asyncpg-0.11.0-cp35-cp35m-win32.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-32 Details
asyncpg-0.11.0-cp35-cp35m-manylinux1_x86_64.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 Details
asyncpg-0.11.0-cp35-cp35m-manylinux1_i686.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-32 Details
asyncpg-0.11.0-cp35-cp35m-macosx_10_11_x86_64.whl CPython 3.5 CPython 3.5 pymalloc macOS 10.11+ x86-64 Details

Total release size: 12.0 MB

Release files / asyncpg-0.11.0.tar.gz

Download URL asyncpg-0.11.0.tar.gz
Size 486.4 kB
Tags Source
SHA-256 checksum
How to use checksums
298ddf8339e6b38720f7b14a2618c864d758416d6247a0a98edad96ac297b0e2
BLAKE2b-256 checksum
How to use checksums
788e390ddee06d07916c6b890fca53c0840264ddd24cf5b6917546e55b03e18a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / asyncpg-0.11.0-cp36-cp36m-win_amd64.whl

Download URL asyncpg-0.11.0-cp36-cp36m-win_amd64.whl
Size 725.3 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
5cf404568ce6bfc133c04b9d050add79aa0ad3ec2fa8bf94b1fe08383b329941
BLAKE2b-256 checksum
How to use checksums
4c44e061b60b72904b81fdd3fa3d7841ebe1dc39a83b62cd8095ec76489179fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / asyncpg-0.11.0-cp36-cp36m-win32.whl

Download URL asyncpg-0.11.0-cp36-cp36m-win32.whl
Size 682.6 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
628bee76be9439a8562e9adc74dbc34600715b8294123ddc8a0b648debfed5c9
BLAKE2b-256 checksum
How to use checksums
1a48ab0bff9c89c0c957d9eef0318404fe0f0c37168a18774195a1d7e2d2c8f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / asyncpg-0.11.0-cp36-cp36m-manylinux1_x86_64.whl

Download URL asyncpg-0.11.0-cp36-cp36m-manylinux1_x86_64.whl
Size 1.9 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
58b7845fbc04b1b10e827ce33a028785784510d4544fc68056178c867e4cefb3
BLAKE2b-256 checksum
How to use checksums
90f775f8e7d0d6d66504091e5895d6c1ea00ea1a1a77424414cb17ce4745e5cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / asyncpg-0.11.0-cp36-cp36m-manylinux1_i686.whl

Download URL asyncpg-0.11.0-cp36-cp36m-manylinux1_i686.whl
Size 1.7 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
b1929929f6bcf8d16a4828614568a47784281a688b23ad0ecf7d667332d66b4b
BLAKE2b-256 checksum
How to use checksums
38908299e793a015e6aa096563a189c9c317f8fa0f75444b79ed8bbe6397a5e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / asyncpg-0.11.0-cp36-cp36m-macosx_10_12_x86_64.whl

Download URL asyncpg-0.11.0-cp36-cp36m-macosx_10_12_x86_64.whl
Size 797.8 kB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
ad7c09a84a8bcb8c9b95d971f3171459722b486c75a767153eb7bb3f1eaa882e
BLAKE2b-256 checksum
How to use checksums
a8983bc06ede34b1f05a3113d39fc798eddf930a149bd24582f233077e2090de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / asyncpg-0.11.0-cp35-cp35m-win_amd64.whl

Download URL asyncpg-0.11.0-cp35-cp35m-win_amd64.whl
Size 717.0 kB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
98e59292ecc3b74314208978957ebfbcc0bf09b2b6b4d65005125960f3dcd276
BLAKE2b-256 checksum
How to use checksums
7fc9520abf3c2dcbc18779fb3ab5cecc4538d05ecd70640ffa2ccbc811228593
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / asyncpg-0.11.0-cp35-cp35m-win32.whl

Download URL asyncpg-0.11.0-cp35-cp35m-win32.whl
Size 676.5 kB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
2c5fb72c8638be531a0e6a401a2c5994d10aa690c302b09581f7214ec1de852c
BLAKE2b-256 checksum
How to use checksums
57fe24f6e1f2ef8eba29ae1a9e170bb738ec058f84ca641c498eb54f37231f31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / asyncpg-0.11.0-cp35-cp35m-manylinux1_x86_64.whl

Download URL asyncpg-0.11.0-cp35-cp35m-manylinux1_x86_64.whl
Size 1.8 MB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
8fbb7f068e48c3bdc3414486731a76b5a62df7c403e1d127fc64571adb05d3cf
BLAKE2b-256 checksum
How to use checksums
b93e9e33d9da92830fb4dcbe5afdecfae37a4f36212ff3063f7b3a66f81e4b6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / asyncpg-0.11.0-cp35-cp35m-manylinux1_i686.whl

Download URL asyncpg-0.11.0-cp35-cp35m-manylinux1_i686.whl
Size 1.7 MB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
75fb47dc14e297f7f46274e5d33a549a82e4d601323998b0da4c2e6103c6ad45
BLAKE2b-256 checksum
How to use checksums
d7f7e6c6a7e4a8ab718123057ed98d610a39cf3d6888f61b72d38d8e78aad09e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / asyncpg-0.11.0-cp35-cp35m-macosx_10_11_x86_64.whl

Download URL asyncpg-0.11.0-cp35-cp35m-macosx_10_11_x86_64.whl
Size 822.1 kB
Tags CPython 3.5 CPython 3.5 pymalloc macOS 10.11+ x86-64
SHA-256 checksum
How to use checksums
d77fdb18e1bbf378f59fcef19c9d0e1cd2ee837f80377e4bc31a195cd4b66f35
BLAKE2b-256 checksum
How to use checksums
f397e63f2c24c175a6d7b22a04afacf58958b73124c10fafa0e0b3e6858255d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.11.0 This release

11 release files

0.8.1

6 release files

0.8.0

6 release files

0.7.0

7 release files

0.6.3

6 release files

0.6.2

4 release files

0.6.1

2 release files

0.5.4

4 release files

0.5.3

4 release files

0.5.2

4 release files

0.5.1

1 release file

0.5.0

1 release file

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