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

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

Uploaded Source

Built Distributions

asyncpg-0.18.1-cp37-cp37m-win_amd64.whl (967.6 kB view details)

Uploaded CPython 3.7m Windows x86-64

asyncpg-0.18.1-cp37-cp37m-win32.whl (911.6 kB view details)

Uploaded CPython 3.7m Windows x86

asyncpg-0.18.1-cp37-cp37m-manylinux1_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.7m

asyncpg-0.18.1-cp37-cp37m-manylinux1_i686.whl (2.2 MB view details)

Uploaded CPython 3.7m

asyncpg-0.18.1-cp37-cp37m-macosx_10_13_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.7m macOS 10.13+ x86-64

asyncpg-0.18.1-cp36-cp36m-win_amd64.whl (967.5 kB view details)

Uploaded CPython 3.6m Windows x86-64

asyncpg-0.18.1-cp36-cp36m-win32.whl (912.2 kB view details)

Uploaded CPython 3.6m Windows x86

asyncpg-0.18.1-cp36-cp36m-manylinux1_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.6m

asyncpg-0.18.1-cp36-cp36m-manylinux1_i686.whl (2.3 MB view details)

Uploaded CPython 3.6m

asyncpg-0.18.1-cp36-cp36m-macosx_10_13_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.6m macOS 10.13+ x86-64

asyncpg-0.18.1-cp35-cp35m-win_amd64.whl (951.2 kB view details)

Uploaded CPython 3.5m Windows x86-64

asyncpg-0.18.1-cp35-cp35m-win32.whl (898.5 kB view details)

Uploaded CPython 3.5m Windows x86

asyncpg-0.18.1-cp35-cp35m-manylinux1_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.5m

asyncpg-0.18.1-cp35-cp35m-manylinux1_i686.whl (2.2 MB view details)

Uploaded CPython 3.5m

asyncpg-0.18.1-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.18.1.tar.gz.

File metadata

  • Download URL: asyncpg-0.18.1.tar.gz
  • Upload date:
  • Size: 658.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for asyncpg-0.18.1.tar.gz
Algorithm Hash digest
SHA256 7a00d116f6420f5a719b8d5811bb048bad1a6edadcc6ee6ccfd05b794c9b8408
MD5 c023985c375e5b0cea7cc4b36c115355
BLAKE2b-256 070439081fe0714b74c35def1fc4e567641df7fea3c7650de94d6bf99dbfa9ee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 967.6 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for asyncpg-0.18.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 5a0c74a2afe97a07f3b3179ccd8af52ba6650551ea350160d5ed20a101be4738
MD5 2d3391502c4ee23dc4309ee4072fdd46
BLAKE2b-256 4aeef2b4e0ef6dfe664c4a47ac55aad9048beef37ad883348eaea34c020651d7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.1-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 911.6 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for asyncpg-0.18.1-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 29bd3d58a555bbb948aabaa7cb74fbf3db316d72e24628f9e44ac15a4b9b3408
MD5 eed4708f2e0a46837efafdcfd165f415
BLAKE2b-256 934fe0ca68cd5be9f0a2c1e8a391e05f7d918a2b5c8ae9bc3bd2e3126d0c0fad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.1-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for asyncpg-0.18.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 070322c9359cf47bc021b26773ae8a924b96a182c367e3afaca54f4f019e6a4e
MD5 1f6a2aae6470c2c6841593d0631a0539
BLAKE2b-256 f6a828328cfd11f07272de270cfc7670d3c2688d55c555678aa9ad7c2e7eae41

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.1-cp37-cp37m-manylinux1_i686.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for asyncpg-0.18.1-cp37-cp37m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 1c634a01196c77377e9c7a6cd405e2f469cbc9aeb5b9152493cd43538fdd6811
MD5 0051ec77c777f60cfc132e5a6f364bf4
BLAKE2b-256 a2b9ae01c028a0c0241939e52d8b67b777e38a6111aa3f29ff4faf4864888baa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.1-cp37-cp37m-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.7m, macOS 10.13+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for asyncpg-0.18.1-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 46f30bf77674db4aa0b7791b3168d18f89ae5fffb2b1f46dcddc988739c872d8
MD5 43b5328f132ae331e15721e04c55f895
BLAKE2b-256 632704a95241e43c748ee84dc5a702f3a15dab6028496189f928802fdf5dc537

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.1-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 967.5 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for asyncpg-0.18.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 bd1c530805e506a29d659922c975fe4576ce2759533feb297ac6d43218def14b
MD5 ed2fe6081dae546bcd13b2d8f59585ba
BLAKE2b-256 2bfe6636a34e6bf1215650aea9cc89650828b9a3104af4731c1feeb3112c791f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.1-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 912.2 kB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for asyncpg-0.18.1-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 bdf6cba9d34c64fd40fd02d36730305d82d8e242c53f22674e8e24e3123402be
MD5 2232e5efc47354e31f2ba35d98d740c6
BLAKE2b-256 f628040fe239ef510aa251d91ab137d1bf6ff7e788405bcf00885dce90bace14

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.1-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for asyncpg-0.18.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 dd495d931b42f21cbb0e8bb953576046faa4ba03bf0f952a6dcb4eba29d873e8
MD5 ca5a8ae8f2573327269fea7f16ad7040
BLAKE2b-256 f22950975276f490d060e16b0d685ea65ed1ed89481aefb4e66436cdb22af5f9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.1-cp36-cp36m-manylinux1_i686.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for asyncpg-0.18.1-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 ff70bfb549d73493c83c242001fff97b00ccf402c58c90cfe12ccb58f842838e
MD5 4f2303f6b617a29f3dfb1aab73216391
BLAKE2b-256 b8eb34f29ed337c93fa5249a10fbc4147f258633f6cc26ed3f85e40ce2913d90

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.1-cp36-cp36m-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.6m, macOS 10.13+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for asyncpg-0.18.1-cp36-cp36m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 8aeabe78ff797e08ba8d02aa0b2b675fe9231287453d5e034ec219335d4509c7
MD5 ee6e7b7923a9214f422a05a704ae5838
BLAKE2b-256 a445785855314377f61186808e882ffc1302fea1d49b504d5a7ce508daa13fa5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.1-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 951.2 kB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for asyncpg-0.18.1-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 50440a7d84999ba4bb9e254788fab7db2f6b4a90b889a927f93daef9a7686dfa
MD5 5ffef8c948947c96513951cec49c4c2f
BLAKE2b-256 216ee934fe0dca4f329786a950884e46b423c917a81ad5510337c4dc7c9fd79d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.1-cp35-cp35m-win32.whl
  • Upload date:
  • Size: 898.5 kB
  • Tags: CPython 3.5m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for asyncpg-0.18.1-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 b61ac7418d7a801773d1a7a5d30be6af3721121dce5d5ac74f7d997241a09a30
MD5 9936c03a0ff578b6afdf0c2492f638bc
BLAKE2b-256 d2b4eded2a1bfbad240dc677daeb87c70b3a6551e5202503103570a3935679ab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.1-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for asyncpg-0.18.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 90ee5c3284c52eb7ac9b1655b22a7a2dd11237462ecd4549afa08c89f8c75e64
MD5 2bf583cfc34354f0ab63a63bd80061d6
BLAKE2b-256 a1c39e57abef2f4de2859f937c39258d83024c285557b65853bc06f87872c755

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.1-cp35-cp35m-manylinux1_i686.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for asyncpg-0.18.1-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 9c02e4982694d9f01beae6f105bced457a9aab68126ae802a796a21405f121e9
MD5 dd174cefaea98f2f2d8e24254775140c
BLAKE2b-256 1dfce13b2a13e68c9443e8883deaa6bd0f77698d5229f6b8b9ffd8e7773d0fc9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.1-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/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for asyncpg-0.18.1-cp35-cp35m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 e1e8220e22445dee16156abe435ad56202a440605898e47c1b873596e0db4a0b
MD5 9b0af900b23cb897d6cc01723cba10ec
BLAKE2b-256 e0951aebde4f1924a5039354775bb9e4d9c667b02cd76e44118a5ff1d0cd9552

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