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

Uploaded Source

Built Distributions

asyncpg-0.18.3-cp37-cp37m-win_amd64.whl (973.5 kB view details)

Uploaded CPython 3.7m Windows x86-64

asyncpg-0.18.3-cp37-cp37m-win32.whl (917.2 kB view details)

Uploaded CPython 3.7m Windows x86

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

Uploaded CPython 3.7m

asyncpg-0.18.3-cp37-cp37m-manylinux1_i686.whl (2.3 MB view details)

Uploaded CPython 3.7m

asyncpg-0.18.3-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.3-cp36-cp36m-win_amd64.whl (973.3 kB view details)

Uploaded CPython 3.6m Windows x86-64

asyncpg-0.18.3-cp36-cp36m-win32.whl (917.9 kB view details)

Uploaded CPython 3.6m Windows x86

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.6m

asyncpg-0.18.3-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.3-cp35-cp35m-win_amd64.whl (957.2 kB view details)

Uploaded CPython 3.5m Windows x86-64

asyncpg-0.18.3-cp35-cp35m-win32.whl (904.2 kB view details)

Uploaded CPython 3.5m Windows x86

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

Uploaded CPython 3.5m

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

Uploaded CPython 3.5m

asyncpg-0.18.3-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.3.tar.gz.

File metadata

  • Download URL: asyncpg-0.18.3.tar.gz
  • Upload date:
  • Size: 663.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.3.tar.gz
Algorithm Hash digest
SHA256 58a5eccaac60fd326e32683226efe1046bfea558fa043360bdd1708e0e812c67
MD5 a660b4f5b7f774341d98aae362294c97
BLAKE2b-256 31233ffa06a7377f8a2630577f692eb61be644df0c1770bb2c2bcf39a1f71d23

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.3-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 973.5 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.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 2dee4fb251139f1c1ee4bd9959d516f930f4da37a2f33b07c2b902b837a76666
MD5 aca2386c3a05ed2304391c8ab45006b1
BLAKE2b-256 d83a8b56d35950fdb1cf5727f5202e575842ce9d8aa4aa5254508bdc3e2db8ec

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for asyncpg-0.18.3-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 fd35a8082b97d5b97d26bcd1b010fdd65a56311d7a02bf2a7e2c56810b9961a7
MD5 95d2c12cce928f93d2020c9f25d631de
BLAKE2b-256 c1fd891b418698020ae0d95a6fce551eaa7b6a7722450eda6281043cf2214a21

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.3-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.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.3-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0677714b26b48d63db728867b812ef365ec3879d2be6fa1c9cf4328503f9a464
MD5 08834aa59477983ce8f3b7b456852961
BLAKE2b-256 a5b5cdf11a7aa96a6df9a1524465069124aa48f23973282ddad651a2d1c70a2a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.3-cp37-cp37m-manylinux1_i686.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.3-cp37-cp37m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 d5450bdf8631fa1200c08a2e70cab06c2e8c09ef608629908531513444d12858
MD5 54d98de870dd15a1b7560e522306af9f
BLAKE2b-256 dcfe9d0bcc3a4851c5c7af85053275b2c13aa5ee88b3b859e6e4e10f15a52829

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.3-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.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.3-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 ab8b9d367e3ef48f35a059642940714a2bda7a7fce8b017b21bfbc4f8fbf8f5f
MD5 a0880abc8d6a505ccd40819f83c5de1a
BLAKE2b-256 e00c8da7fc062269dce370e75e5d0b779f450fb15a3dfbe7c6c0df167c3e9bf8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.3-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 973.3 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.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.3-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 cc7aa61bf41273ee5d4c11e0e72c0d9340e9c4dbf752464ae2b6816abadaabce
MD5 a7ad8342eb4f4b610ffed63562efc506
BLAKE2b-256 c4cf930b921651a1ec22312f4e5ea44c9004d39d2fe18ef24d87effeb8df9a21

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for asyncpg-0.18.3-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 c1fe1f0ef848f0f17bf63b90a4c3f446a14e4c899d8531ea988109cc0de014e5
MD5 1853f22cbb434107cf3b9467b621a7e0
BLAKE2b-256 597daaec9d329b8f44848ce416b5319e9a8814c64e8bd8bd8a362c361ceefcc6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.3-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.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4a779a85302241782bed8ed0f2bcb38544805b3e107b16ee7489c5818d8f4228
MD5 34b22f459b02efa6953f24a731972204
BLAKE2b-256 25eb9674bb30b80403ee3110dcbd54d71080dfc71d0774760955353aaa5c1627

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.3-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.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.3-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 4539bc2e63600a1ee999086bbb59bf717ab32ea771ac20b5b792a2234633b5fb
MD5 40bbbc788115e0e55b23e04af1faf8e3
BLAKE2b-256 90e26d20f1ead456cb4af7c6858d4e101fe4ce5877306eda821a3d77769b6c12

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.3-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.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.3-cp36-cp36m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 51a3d67a3fa43112b17ec510338723932e1e0611ad99a146acc9960d32210196
MD5 3ee41cbf61db738a87fa7c8a21b41a44
BLAKE2b-256 919a8c20773a2ceb873a49145021524590d8867026e6e8eb84afe1e48c9b7c1a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.3-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 957.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.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.3-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 fd2d13da29f55c2c71b1acc9d9f107c7a5176fffb3f62ff503f2b300f7ecd74e
MD5 19c3fbb80bf9bbaf442888ac15ca8865
BLAKE2b-256 5d771b529eb0f53edbd9a487eeac82491d541d8c9b07fb5d0785f070cb581a6f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for asyncpg-0.18.3-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 378a7ef11ce7b35f11eb816e5252bc1e779119f7583a872233b45a76effac02e
MD5 21438ac2e809da3e0b4d43915a3b7fd0
BLAKE2b-256 5aed3bca61ece6d9f21f725111b274ea483170c9f55ba93fe3e9168e8348c711

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.3-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.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.3-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 84084f7dfed0b2d397a0c2fd7eaf29b01904c74f4320e5fe95ad3042042cf188
MD5 b2dc4463d4bd07cd0891108a9f915418
BLAKE2b-256 30b0fcf5fcdeb8ce9ced0b18cd291f754e57c10b9b4121a2f06dd8180eb29577

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.3-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.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.3-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 89e727fdba05d90a0156d9d18932fd44a2baa84e90e3368573f432a308ad8fd7
MD5 4d8b04bb2631fb92cc9f4c385bb4258d
BLAKE2b-256 3472b21696f273af9baef19c9784325020577e0bb0a65f777fba216c89840334

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.3-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.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.3-cp35-cp35m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 814343dc2baa489a11521ff9fad68f337a05c9ae0461fdf9f1ec7ac3541c13a9
MD5 8cc08be7084e1ee109d6d9e89c49e340
BLAKE2b-256 50f6756ae90b7a5c3568d2b933dc4547ffb55cc0649f97db01e722649aa09076

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