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.9.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.9.0
File Size Uploaded
asyncpg-0.9.0.tar.gz 404.9 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for asyncpg 0.9.0
File
asyncpg-0.9.0-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details
asyncpg-0.9.0-cp36-cp36m-win32.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-32 Details
asyncpg-0.9.0-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details
asyncpg-0.9.0-cp36-cp36m-manylinux1_i686.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32 Details
asyncpg-0.9.0-cp36-cp36m-macosx_10_11_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.11+ x86-64 Details
asyncpg-0.9.0-cp35-cp35m-win_amd64.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-64 Details
asyncpg-0.9.0-cp35-cp35m-win32.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-32 Details
asyncpg-0.9.0-cp35-cp35m-manylinux1_x86_64.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 Details
asyncpg-0.9.0-cp35-cp35m-manylinux1_i686.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-32 Details
asyncpg-0.9.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: 10.2 MB

Release files / asyncpg-0.9.0.tar.gz

Download URL asyncpg-0.9.0.tar.gz
Size 404.9 kB
Tags Source
SHA-256 checksum
How to use checksums
95bfd835f19c1b123bd5672e76d166d7a03fa6f64ea6b650f44ad9216bd9db88
BLAKE2b-256 checksum
How to use checksums
4ed9942231219d4f576c45a1ad9903b2a8dad70706ab47819a55b25ddc8736a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL asyncpg-0.9.0-cp36-cp36m-win_amd64.whl
Size 618.6 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
3fc4296e63dc14cf96ce3445178de5ed4435bb08e4924a58148bbff0e4686d38
BLAKE2b-256 checksum
How to use checksums
e73f52a66e95241f9e1392ac90239edd5d2df9ed579e7fa9f53b46490884ae79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL asyncpg-0.9.0-cp36-cp36m-win32.whl
Size 582.5 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
676bb6c8339ccfbe7fd2805084a6cf051dc4269ab4b9a2f69fb2ea4d98bdbcf7
BLAKE2b-256 checksum
How to use checksums
cd9b421d57d348bf7e67853b80f4f59893178edc230249295971347a2e51c0ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL asyncpg-0.9.0-cp36-cp36m-manylinux1_x86_64.whl
Size 1.6 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
a3703803c62b7a233ab098a410d976065d3c57dd81617df4f4f478099b131abd
BLAKE2b-256 checksum
How to use checksums
80ab04d3e678798f4b981c04708a60a33ba13d59fb50e72aec5aec9cb5dca8ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL asyncpg-0.9.0-cp36-cp36m-manylinux1_i686.whl
Size 1.5 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
1b803c1c16bbebc3feffa188b2c35d708d2b3adb2f0fbf3ce9afaf505fdd827d
BLAKE2b-256 checksum
How to use checksums
8c1ec033a30b67e2819526b763f37ca2ba1c7392cfdf9b400b55e33c367073a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / asyncpg-0.9.0-cp36-cp36m-macosx_10_11_x86_64.whl

Download URL asyncpg-0.9.0-cp36-cp36m-macosx_10_11_x86_64.whl
Size 711.8 kB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.11+ x86-64
SHA-256 checksum
How to use checksums
a06ef576f65f975182b233346c739e1cf21de321cc7f7d4994a4a5ae9d4c8eed
BLAKE2b-256 checksum
How to use checksums
fc8f04a6eeccaf2a02d06e0d1a5b997be8e5f2f4f637f7fe8baa9cc3f6a85f22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL asyncpg-0.9.0-cp35-cp35m-win_amd64.whl
Size 610.9 kB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
6890b80b0307e9a16c6187ee86f4db6072a8e4af71aaa59047d54e9f9c917d9c
BLAKE2b-256 checksum
How to use checksums
87518651d1d5886a769bc335910e8b797014d48b61dbdff3de4ce6af991a46d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL asyncpg-0.9.0-cp35-cp35m-win32.whl
Size 576.7 kB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
80a1d373549895eee178e57fc819ca65e9210b04a2d76156e1bab891f64fc0bf
BLAKE2b-256 checksum
How to use checksums
5a183ac6cc325b128577742e042f7ac42940b6db088d454ffff5c58329093b57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL asyncpg-0.9.0-cp35-cp35m-manylinux1_x86_64.whl
Size 1.5 MB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
3ca234885de665283c5c496377d5e0ff75065b43e020701c0985095850acf61c
BLAKE2b-256 checksum
How to use checksums
6473bff72c60346eb8621c7f4a0c02d3491f46a67622345e4687877ee5d64350
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

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

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

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

Release history Release notifications | RSS feed

This release

0.9.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