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

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

Uploaded Source

Built Distributions

asyncpg-0.14.0-cp36-cp36m-win_amd64.whl (879.7 kB view details)

Uploaded CPython 3.6m Windows x86-64

asyncpg-0.14.0-cp36-cp36m-win32.whl (825.7 kB view details)

Uploaded CPython 3.6m Windows x86

asyncpg-0.14.0-cp36-cp36m-manylinux1_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.6m

asyncpg-0.14.0-cp36-cp36m-manylinux1_i686.whl (2.1 MB view details)

Uploaded CPython 3.6m

asyncpg-0.14.0-cp36-cp36m-macosx_10_12_x86_64.whl (971.4 kB view details)

Uploaded CPython 3.6m macOS 10.12+ x86-64

asyncpg-0.14.0-cp35-cp35m-win_amd64.whl (868.9 kB view details)

Uploaded CPython 3.5m Windows x86-64

asyncpg-0.14.0-cp35-cp35m-win32.whl (818.7 kB view details)

Uploaded CPython 3.5m Windows x86

asyncpg-0.14.0-cp35-cp35m-manylinux1_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.5m

asyncpg-0.14.0-cp35-cp35m-manylinux1_i686.whl (2.1 MB view details)

Uploaded CPython 3.5m

asyncpg-0.14.0-cp35-cp35m-macosx_10_12_x86_64.whl (972.6 kB view details)

Uploaded CPython 3.5m macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: asyncpg-0.14.0.tar.gz
  • Upload date:
  • Size: 589.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for asyncpg-0.14.0.tar.gz
Algorithm Hash digest
SHA256 bde645b82af46f77b8d211fcc4f7b367f00e6f2b4787045c8a107c4c68776684
MD5 3a11968dc876311445276b57b5e45c90
BLAKE2b-256 bbf405ffc40f706ee91584d8d46210699920e60ec4973def97459d6185acc2b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.14.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 623775eae1992c1dc665592ae1358a4d4ca002c9b4344d51e0089f6da62461c5
MD5 f300f3af1bc8bf317d1254512bc253d9
BLAKE2b-256 8176be89cf9cc3fd6c0e6129598f62594ff28bbb0f669687dbdff63dda0858cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.14.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 b20e2108e270965a2a0463ceef14aad27286ab4a9cde74520f8d430a8296a513
MD5 cb1d9edae8bea5e78c9c117acb02a797
BLAKE2b-256 8582e395efef9436ccb119faad224f03a49f7721577bb8fdb4013aee2e98782c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.14.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4c1b4220bb0230b6464648a89257240af83069bf06a131e46fedf7e8916a6614
MD5 71ff4f3f0cdcf4a0f261910b480a945f
BLAKE2b-256 e811d002166b0d78ae9071ed1f7297c2565f2645a9422d1f1900481d806fa466

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.14.0-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 7884a7e896e3b5f042d55867bfddd85e82afc83261ad297eb969c2e096104f96
MD5 a6f67197abc18d455b33012566ae26b4
BLAKE2b-256 aab788e05f3eb6e9ee9b25af9d1e3a0e073618fd9635361322bafeb43e55dede

See more details on using hashes here.

File details

Details for the file asyncpg-0.14.0-cp36-cp36m-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for asyncpg-0.14.0-cp36-cp36m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 aca8ce25766a1d5b3843952bfce546ec5d871052ca10243e9301e142dba1c184
MD5 a75119afbdbae280339cf3a0a315ac46
BLAKE2b-256 b7ede70037346497f96270672a8669fb9a85c9d590b13be20507195306ffd050

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.14.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 b8f2e69d4df13b5734b259ebf0cd6875498b870caf0e3cd4a4468d4a80fde1d6
MD5 e0483aee36346a8ce68df798b8579a05
BLAKE2b-256 bc04ae32e9aff8cb95691498d3a33e8bc49529cbcbac53a43eb7e599e6020ad8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.14.0-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 79d3240245fc7b7c3a1608c9c4c70f8377d4888c5d62f9fdde43e262bf24d19e
MD5 245e36b9e52e17587dc558f7863f97b6
BLAKE2b-256 a4c79ac3e2d31ba7490c2ab61583f800a11e26f195f3e0d6929795721020430c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.14.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8fb461730d92dae7fe99d77b97515d5c70ef41a68549c4ae379863c2a9f85ee2
MD5 733f8a771c62344709072343ab301a6f
BLAKE2b-256 3ac948117837b706298578ef45e94708a9b23202a9519f09f6a67efbcfa49065

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.14.0-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 b9c79f663fb15cc702b94fedb3c9dd793b4cd404b1aa14a075a116dc7d47848c
MD5 1ecb2bea81045907bce6aae6cfa476e9
BLAKE2b-256 95363e6627c6478507a343191d9eca3731defc16cec8b19d90e8859884b65785

See more details on using hashes here.

File details

Details for the file asyncpg-0.14.0-cp35-cp35m-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for asyncpg-0.14.0-cp35-cp35m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d6b9a70256c900c9f0f25f3f601ac309bdec7fa3a06123a76f1aa7af02094f17
MD5 9933d23e5e93f207c410000b4525e93e
BLAKE2b-256 9d11f91d3e7c660292fd0e1b640837a4eac63f85561b4d1d5d81e92be7bd8d8f

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