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.1 to 9.6.

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

Uploaded Source

Built Distributions

asyncpg-0.8.4-cp36-cp36m-win_amd64.whl (621.6 kB view details)

Uploaded CPython 3.6m Windows x86-64

asyncpg-0.8.4-cp36-cp36m-win32.whl (585.1 kB view details)

Uploaded CPython 3.6m Windows x86

asyncpg-0.8.4-cp36-cp36m-manylinux1_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.6m

asyncpg-0.8.4-cp36-cp36m-manylinux1_i686.whl (1.5 MB view details)

Uploaded CPython 3.6m

asyncpg-0.8.4-cp36-cp36m-macosx_10_11_x86_64.whl (717.1 kB view details)

Uploaded CPython 3.6m macOS 10.11+ x86-64

asyncpg-0.8.4-cp35-cp35m-win_amd64.whl (613.9 kB view details)

Uploaded CPython 3.5m Windows x86-64

asyncpg-0.8.4-cp35-cp35m-win32.whl (579.2 kB view details)

Uploaded CPython 3.5m Windows x86

asyncpg-0.8.4-cp35-cp35m-manylinux1_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.5m

asyncpg-0.8.4-cp35-cp35m-manylinux1_i686.whl (1.4 MB view details)

Uploaded CPython 3.5m

asyncpg-0.8.4-cp35-cp35m-macosx_10_11_x86_64.whl (707.3 kB view details)

Uploaded CPython 3.5m macOS 10.11+ x86-64

File details

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

File metadata

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

File hashes

Hashes for asyncpg-0.8.4.tar.gz
Algorithm Hash digest
SHA256 700ecf42bb1aa057b3fb78599315983d73315b56c65382eb9c81d755c9faf1c0
MD5 89607e36b271e42df028b32e5edc7d8d
BLAKE2b-256 330afbb965abd9c845a179d9834cb624840ee495266cc3e8121d1ad0b7647c1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.4-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 7192e2cf21055907e6f0ebc125156480e07d9d4fdcbe9b6f6479e81fd754b4f3
MD5 c6f209361e11dabc7376244ff96628f1
BLAKE2b-256 a70eff74418674f73158af38d6d2c5336092ab1470e887f1873e2d29708765c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.4-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 677f1ed7d26b5c38a8e8dbb8c3a70d76fc6b089dfc183392ddac713093249892
MD5 cb6ab385ab1094ccf38522e1d52d3bbe
BLAKE2b-256 2ebce33f077875732896fa4eec3ae324c1d17e7d8fe21f908c56dd5d45f2ef69

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.4-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 65843464bf27927789b6f151ac604381a978b109ddedfccc46c4775264284603
MD5 3b4d24da369171f20757d9d37efbe69e
BLAKE2b-256 1e996452c59eafe0d27cc2926af532f68b5f17930d438c6f5867d915ecacc8f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.4-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 b863d52a4246cbca8d84d144dcfd2423e10c0d7ffce35c4ff5d3f372f7f9bc3f
MD5 cba328cf949abb12df5d73cbceea1cf8
BLAKE2b-256 a83615eddf942dda17c56363185e768621fefb373371e47c2d510c37c1eecc1e

See more details on using hashes here.

File details

Details for the file asyncpg-0.8.4-cp36-cp36m-macosx_10_11_x86_64.whl.

File metadata

File hashes

Hashes for asyncpg-0.8.4-cp36-cp36m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 54452592ad21867c7b3282755d6c5168a78123ae4eee5c2bc3d032a1d2da1120
MD5 d7f54332657030d1fb7250f0d77dff97
BLAKE2b-256 c95961dd213c9f6cf2cd6875f3e5d38ca090a42bb997e190b1e4e2a050022ec3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.4-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 468c48b2fc77f7d278779c8cc5b760312f1b52dba8cdc80e3443e7657ddd2030
MD5 8bb2d718d883b0144a6d04bfb7aed39c
BLAKE2b-256 0f5b49b9ec62b5796c540f88b629af815cec8ac0cd6add90149967f0855ac43f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.4-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 9c9af1cf4d272fb0da3c6ed072b1f085b311bfc495fba11da8748fc1e0253baa
MD5 96963549426048d7785b894522fa159b
BLAKE2b-256 56042cef34a52209ffb66f6e0a166ae31142a1f5898b32a1bd7f7fa8780cc30e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.4-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 96ff71bc1b1b74c82c9ed51a7064680489759b35656e84f7d379110e1af355e5
MD5 e2de1bc3be33ae7d865543f6b10b8ed4
BLAKE2b-256 2f56e944fb40f1551f644f3065ad8a84f9744e4616f93ecb167341a050170d5c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.4-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 68ce09c9712647433874aa8917845da548a6dc815644afdfcc43d6ad6d713adc
MD5 0da88b503465f021935708033d483ffe
BLAKE2b-256 85df282a7920b3f017c30cfd66e06b062058dfd8d0f5c39e7557ac06a59211c9

See more details on using hashes here.

File details

Details for the file asyncpg-0.8.4-cp35-cp35m-macosx_10_11_x86_64.whl.

File metadata

File hashes

Hashes for asyncpg-0.8.4-cp35-cp35m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 7a9d2856148fdf49f647975fb7d43205399b5ec7bd43c6c732cee3127f5ae4f7
MD5 1027d717cc16bc1aefb42cc2e49d832b
BLAKE2b-256 49884e5873becde333ef5f10c2a9e4dc8c18373a5cccac0be5142f7b00614b57

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