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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m Windows x86

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.7m

asyncpg-0.18.0-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.0-cp36-cp36m-win_amd64.whl (967.5 kB view details)

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m Windows x86

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.6m

asyncpg-0.18.0-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.0-cp35-cp35m-win_amd64.whl (951.2 kB view details)

Uploaded CPython 3.5m Windows x86-64

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

Uploaded CPython 3.5m Windows x86

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

Uploaded CPython 3.5m

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

Uploaded CPython 3.5m

asyncpg-0.18.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.18.0.tar.gz.

File metadata

  • Download URL: asyncpg-0.18.0.tar.gz
  • Upload date:
  • Size: 658.6 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.0.tar.gz
Algorithm Hash digest
SHA256 39b133ef78afd0040f275e493a4b433d8e44a08b998487c2eaae21841dc3013d
MD5 596ea463bd1002202b2c16d6f80658fd
BLAKE2b-256 32b5a89be82265f709eeb250cf691cc5dbfc6fcf7ed84ad3636d44811ed443db

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.0-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.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 3c966c7acfd6dc270bf77d5641c79d0a3d2367799b13d92a5eb625d72534f4b9
MD5 0b3e0afb47cad26329f3883811bde464
BLAKE2b-256 a8178791d968462848eed94296fe122a2f047731362def23f6b9b94bda16830e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.0-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.0-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 d61cfc6bdee72466f40ce8b2b92637c65d8ac0a230a6cd61b7e603b4255a04b7
MD5 c451c44302c455005d2af66476b7f02c
BLAKE2b-256 203660ec33315e22ab7035c14ae4c3bc0ee1acb5eb616e8f6ab4887cdef027a0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.0-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.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 eac4b98e25fada6cd84f9eef3de372386e81128c9a4813d630c6ceaff626068f
MD5 4a0ad955655430dd4ddea1b3c01b8123
BLAKE2b-256 c1e9088e577eda9be9ac4b20f981a9794103b44340284c83521ff8d1b80e0b07

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.0-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.0-cp37-cp37m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 3a471f56b7c719be5a507eab63c6c5d8ad79fe44c8e1fade85ac49e3e69d45c0
MD5 5149f39c1729d920fc33e6ecdceeea33
BLAKE2b-256 60ed3f0be279cd529a9b3d2680c4bc15cd4aaf889110ea7c26feea0dac8fd6d5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.0-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.0-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 5f41b5150e8c5e4e5d4bf80d8415edcfef2753f4ce81fe1485806060f3de92a4
MD5 4197eaaff218d548452852956379ebd7
BLAKE2b-256 7ef393f2931c3ce71933ce98157b17d89dd9f2497d30e116cc8a79e906472edf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.0-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.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 69f34d9cd0f81d24c497c89b09ce5c576c62372ee4e138d5b83bfa5b5e28d47f
MD5 33535c3cb18081c03b0451f2a0dd5bbc
BLAKE2b-256 d7e8f32cbc2b8d4fc16d96ed974f4686dba738589f210a53f153e21d65ac26e2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.0-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.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 a0e5f6ba1ffb68240ca98ebee5140101f9dbc75499dc10afa1a07b006bf79970
MD5 cd4345b06b91d90ae44777d4d1f9f3fe
BLAKE2b-256 8723a79b0f449b23023bb8b1d8ba3cbc321714692bbfd34a7c081ffbf8451c8d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.0-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.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 fc28e13d341b447c3cbad4a2a8e1a4a4f88e219a208b3116bb9ab2a4ecec9099
MD5 9c04fcf626a1ff7d31033e5af793decb
BLAKE2b-256 407d5492ef5093ee869f03a5d0008d8ebcbcd5fa9356ee424541213d193d7be7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.0-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.0-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 a29ffd12860be3e94c162e66a6b3e5eb9b9172199b73485d525afefd857ca81f
MD5 ba8afc8885254a1d2f5efa3e648da00b
BLAKE2b-256 2eb2e939fbed01ecff18532b39bca225dd97fa8482ac4d500dd8b56025638402

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.0-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.0-cp36-cp36m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 3d794641731b522e3970226614aeac7f845e18c6c777555600f52f2da3eb60fa
MD5 24921321cd31613d87a05ca589b8d734
BLAKE2b-256 1836451fcb174df1641522858f94e4e620beb084977c0ef6e1bb0eed75a031a2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.0-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.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 1cec723e67d3632dd5d651ef91dda5f2c48b5d269a93977d67ef674980fce211
MD5 e1a7d60b9da8432d1a45af26d6d99b06
BLAKE2b-256 fa0e52d6ee85ac600adbd22d494c420645b4dd92f6a62226dcde1acb967c6e94

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.0-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.0-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 3592b201d7b2897d92258808c3a2501be27eeee1f1f7a0911d59a56c034d0fdb
MD5 06ded67623a82fc9d928d91bcc42e194
BLAKE2b-256 f8d48fc63d1ef97240750f003ee32487115625292984effbf54959271d784b8a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.0-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.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 58ba9a6ee9e05666448050f049964448a195bafa830d0b85d502123654dc1de2
MD5 869d097865baef901143ff6f88690b18
BLAKE2b-256 39b7dbb12b4b67fbe8fe452d37ef36b1ab6eff99ae1664febe56c55f325f80df

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.0-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.0-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 caf2ccabe46c7b04adfb9daf797bec97e5b02023133d728b0b7f7e460cd63610
MD5 385e3160740fc825defd4f1b7e720adf
BLAKE2b-256 9391325d6d1d3fb651c733bde111bc196732550d4c0bf48eff7a6995a508f002

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.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/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.0-cp35-cp35m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a083125a66e9f3c23a192640a913cbe75b69c76fdfacb9b43f3785a66bef6a30
MD5 5a8f6dbe815c35af6b575db77bb9faa4
BLAKE2b-256 f3a17160c2f1e33720897b6e3390719177933bcf575f0128e5d43332df337058

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