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.

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 requires Python 3.5 and is available on PyPI. Use pip to install it:

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

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.8.2
File Size Uploaded
asyncpg-0.8.2.tar.gz 377.2 kB Details

Built distributions (wheels)

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

Release files / asyncpg-0.8.2.tar.gz

Download URL asyncpg-0.8.2.tar.gz
Size 377.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6e3739068bd3125f466cb53bd2cb035d4a47330adf4696ad0cde53e11a4cb8e0
BLAKE2b-256 checksum
How to use checksums
5824fd0ffaa77530189e5653e411e41c56173419753924c178a4e232f0ed53a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL asyncpg-0.8.2-cp36-cp36m-win_amd64.whl
Size 582.8 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
09fb72a67a5702f28751279fb30d2c94ae904b8efba5cc7e1f54a9653d09df9c
BLAKE2b-256 checksum
How to use checksums
7823d54dc7e80a6c4363e0cbcd3cb69fce961063f7377c28cd07a1d9014d8aca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

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

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

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

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

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

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

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

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

Download URL asyncpg-0.8.2-cp35-cp35m-win_amd64.whl
Size 575.3 kB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
0d5dd2f091251e33dce25b140f79f709180d4453207a1ee3d355bf5c36cf62fe
BLAKE2b-256 checksum
How to use checksums
15e13668cd50350411cf934435fa6e179101e4a90c1177211e536a63ba6b465b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL asyncpg-0.8.2-cp35-cp35m-win32.whl
Size 541.2 kB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
0087c89586ca98906597435e797351fcbf5f1731c77382ed8c21c8199a2dd3d6
BLAKE2b-256 checksum
How to use checksums
6f0a6c6761fc0514d86134de0f616a0f84e86ac4230aea5d771ce8fbc723989d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL asyncpg-0.8.2-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
4d9015f8c9d6fc3aefe1b7947b0a93afafe3c5edd9f4a8c969216026d1de753c
BLAKE2b-256 checksum
How to use checksums
1861ac7dcfcaa8b870b2f8e53b125f95484b3539bddd3b676945148341130ff5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL asyncpg-0.8.2-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
1cd446159c611163d1c5de28aadc059f2db500a1d71d64d95de584326f75ef77
BLAKE2b-256 checksum
How to use checksums
9a58ad75001f95b21f9de3068a636f998f8e081efb48b62cd9afcf2f91f52f9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

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

Release history Release notifications | RSS feed

This release

0.8.2 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