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

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

Uploaded Source

Built Distributions

asyncpg-0.19.0-cp37-cp37m-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.7m Windows x86-64

asyncpg-0.19.0-cp37-cp37m-win32.whl (981.9 kB view details)

Uploaded CPython 3.7m Windows x86

asyncpg-0.19.0-cp37-cp37m-manylinux1_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.7m

asyncpg-0.19.0-cp37-cp37m-manylinux1_i686.whl (2.4 MB view details)

Uploaded CPython 3.7m

asyncpg-0.19.0-cp37-cp37m-macosx_10_13_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.7m macOS 10.13+ x86-64

asyncpg-0.19.0-cp36-cp36m-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.6m Windows x86-64

asyncpg-0.19.0-cp36-cp36m-win32.whl (982.5 kB view details)

Uploaded CPython 3.6m Windows x86

asyncpg-0.19.0-cp36-cp36m-manylinux1_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.6m

asyncpg-0.19.0-cp36-cp36m-manylinux1_i686.whl (2.5 MB view details)

Uploaded CPython 3.6m

asyncpg-0.19.0-cp36-cp36m-macosx_10_13_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.6m macOS 10.13+ x86-64

asyncpg-0.19.0-cp35-cp35m-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.5m Windows x86-64

asyncpg-0.19.0-cp35-cp35m-win32.whl (966.3 kB view details)

Uploaded CPython 3.5m Windows x86

asyncpg-0.19.0-cp35-cp35m-manylinux1_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.5m

asyncpg-0.19.0-cp35-cp35m-manylinux1_i686.whl (2.4 MB view details)

Uploaded CPython 3.5m

asyncpg-0.19.0-cp35-cp35m-macosx_10_13_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.5m macOS 10.13+ x86-64

File details

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

File metadata

  • Download URL: asyncpg-0.19.0.tar.gz
  • Upload date:
  • Size: 703.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.19.0.tar.gz
Algorithm Hash digest
SHA256 b253bbbe42eba8e00ad63939ff9d43a5f74e26a4e8f883de867920feb4a9e36a
MD5 2add7c7ee742008425a090532d2b4ac8
BLAKE2b-256 d4f561d0fda0903a62884b5a11b598b7d12f8f0d66aeeb4b019f3e3d2548f396

See more details on using hashes here.

File details

Details for the file asyncpg-0.19.0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: asyncpg-0.19.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.19.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 0527cca24a1bb90b7872867518f25f51a431116075bebbe86149fef593630736
MD5 65dde1028083a6d6bb2b1e2b7e5781fc
BLAKE2b-256 4a73df867f59d58a40ac807846f04d18b946401138562cb393252d4a5a4f2730

See more details on using hashes here.

File details

Details for the file asyncpg-0.19.0-cp37-cp37m-win32.whl.

File metadata

  • Download URL: asyncpg-0.19.0-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 981.9 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.19.0-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 16c2accafda9410fd7e8ee561c2bcd1d3141118be81dc9eccc4e671877fecb72
MD5 bfad0973cb02bfd05c7440554aa910e5
BLAKE2b-256 67e8ea8c0e3254e74f5ccfde4d2f2c1f585e2658dc1e7c3393688cafec361752

See more details on using hashes here.

File details

Details for the file asyncpg-0.19.0-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: asyncpg-0.19.0-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.19.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6a9d9824c29a72dc109b9f9e7916c36bbb6ed15e1f3154aa976ac776caf9ad88
MD5 45b339875d69bbcea32c738c0b8f490c
BLAKE2b-256 59e7aaf05ef85c7eefa57743015723aba9b51bd14023201a496f590ca97248d7

See more details on using hashes here.

File details

Details for the file asyncpg-0.19.0-cp37-cp37m-manylinux1_i686.whl.

File metadata

  • Download URL: asyncpg-0.19.0-cp37-cp37m-manylinux1_i686.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.19.0-cp37-cp37m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 cebf06ac15626f3ccb6a537fe593460cdd581bf1aa33dbf3068a21dbef7e393a
MD5 d904a9f31f3608588bee410a411957ac
BLAKE2b-256 a8a8cdb3b9fe82431d75c18a2b41368a710110a0643819d2f78d7595d74dfc01

See more details on using hashes here.

File details

Details for the file asyncpg-0.19.0-cp37-cp37m-macosx_10_13_x86_64.whl.

File metadata

  • Download URL: asyncpg-0.19.0-cp37-cp37m-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.7m, macOS 10.13+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.19.0-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 d3ac4751ae5f77fc646cfeb3f9180f2561eb0876a6b7619cb4e4e290e3432811
MD5 affe212f1d98147e564d477a373ef9e4
BLAKE2b-256 eb6feeea98476852be2cba5f6a822cc4f216662a5df0b58ab04b2b54202d4644

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.19.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.19.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 35ce817f4a1cef966434e564b69e760d98f0fc2bac73c8786058bd6136ed304e
MD5 85c63c449d791133b8b90c6bb5bb4d5a
BLAKE2b-256 9058678befb37066cea5e0f8f6560755aba682faca51bcff1b010c8c2aef9bbc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.19.0-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 982.5 kB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.19.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 45254bc128b175cec75c1cbc64de77bdf5593cbff4cdc58c4ca810878ddfe00b
MD5 71419bdb916bb655ce4bbdcc9053062e
BLAKE2b-256 cc5c69bab654f59809e72bd3d1670f9271e882e43dc275ffc57a34e4d0e54e3c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.19.0-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.19.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ccad6b5a59b1c27623c48a840d1f6024994551f27ca0d6c253f64004eaf8a3e6
MD5 dfce110fb2002b0eec355d5e62ba68cd
BLAKE2b-256 9f2ed59120bedcfca6c896b4edc2efedacbab157a0faef5db2fb3b00d294c3b4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.19.0-cp36-cp36m-manylinux1_i686.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.19.0-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 e41c8ef26019c27f76cb280dfebad23f84af99ac846b19bcaea06f1b2a2f5fce
MD5 20cbee04415e15f667474fe0abd82801
BLAKE2b-256 3fd710327f00d8b59b779fa4febaa0f86466e16c5f08d59afd4ca38c812f8258

See more details on using hashes here.

File details

Details for the file asyncpg-0.19.0-cp36-cp36m-macosx_10_13_x86_64.whl.

File metadata

  • Download URL: asyncpg-0.19.0-cp36-cp36m-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.6m, macOS 10.13+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.19.0-cp36-cp36m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 8c5a9d6573940fe81de36af78459988b5672e427e95667323fe7dfd97f00cd09
MD5 19c30632519010ec8ef1f4bd393c22e8
BLAKE2b-256 20e57bdedc2b0f9a99800089bd7476a81667b85eb3a57a04aea582caaf4be1e6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.19.0-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.19.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 8992efcda3022e82966857989c999d5da0e9fc76394f36099700ce544ef39621
MD5 6e44d038cb6a87692067b21330ee9414
BLAKE2b-256 b1f1d1b7854a0dacb6c54ba5088a0fed3799137db6fbb955c1f613718d63b9ca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.19.0-cp35-cp35m-win32.whl
  • Upload date:
  • Size: 966.3 kB
  • Tags: CPython 3.5m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.19.0-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 aab3a90dba30fe9017b5326727b505e18fe024c2e205655d52e85f9b24f5b2ab
MD5 a2dcf268a1586f32626443eb5700b73e
BLAKE2b-256 b9d832b83b5a5335a7afdcf82deaf2f64e7b0808a9d7b5db667fd63941c9abaa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.19.0-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.19.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 426eb401b760abb0ce670d1d09201f1ae5a58355d272c413d1f7d7b6e354b00d
MD5 ada3410893b434d4679114642e4c2d4e
BLAKE2b-256 bd707f6f42a66b31e1cc608edab89fb897e44559b34c9cffbeaf32db9e3939f5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.19.0-cp35-cp35m-manylinux1_i686.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.19.0-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 f3e9863510b4e54ade1d20af5ef18901dea44e4fd7259db516b73810c0a1ad2e
MD5 e5e4803c719581b685332311d1dc99d1
BLAKE2b-256 d75a0f2134fe874c21b803d1ba22742ae902a7de5dede5c6a45434f21aef7a39

See more details on using hashes here.

File details

Details for the file asyncpg-0.19.0-cp35-cp35m-macosx_10_13_x86_64.whl.

File metadata

  • Download URL: asyncpg-0.19.0-cp35-cp35m-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.5m, macOS 10.13+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.19.0-cp35-cp35m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 81431aac651d0386f483697d831cd9cb6efa816fd08dcedf0387602f52c1d4d0
MD5 1178a70cee1b0966e806fa3cc7a4f91e
BLAKE2b-256 f5aec2e6b1ccc699ee918b726e8739be91dce9028b75feea5a26f5e375946c0e

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