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

Metadata

Release files for asyncpg 0.13.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.13.0
File Size Uploaded
asyncpg-0.13.0.tar.gz 573.4 kB Details

Built distributions (wheels)

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

Release files / asyncpg-0.13.0.tar.gz

Download URL asyncpg-0.13.0.tar.gz
Size 573.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f5d59fdde5b26f0f56db82906606344e9b5c9804efd50dfcc858862625dcf858
BLAKE2b-256 checksum
How to use checksums
1c26be07387afa41552a1c9d4860ac3ae31eb08cda506c84f7c49b5bda25dd0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL asyncpg-0.13.0-cp36-cp36m-win_amd64.whl
Size 862.1 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
a1b79091f53999dd4ec7fc02ccebb039174559efc65ea80ae0f18cf723c94881
BLAKE2b-256 checksum
How to use checksums
114a9bca71e9cfce778d96ed48c1c0c9b3f42bbde951adf6d65054fec157a326
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

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

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

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

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

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

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

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

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

Download URL asyncpg-0.13.0-cp35-cp35m-win_amd64.whl
Size 851.8 kB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
85fa780604cb63500f4e7579230b0c2e3e9db591cfadd96bd8a6a4c0b6a0b3f6
BLAKE2b-256 checksum
How to use checksums
675feaf41df8a5a0c194815eb92e57a5b0ea9612fb8cd32cf2be6b8e679b83b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL asyncpg-0.13.0-cp35-cp35m-win32.whl
Size 802.1 kB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
88d440fef2a61cbd97add25970aec124ed0a7eb57afc7f3c219ebf2d80fdf967
BLAKE2b-256 checksum
How to use checksums
6bf1c9411e613a144a83c9894aecc11ddb0941a3e500851748a92786990c1227
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

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

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

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

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

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

Release history Release notifications | RSS feed

This release

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