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.

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 requires Python 3.5 and is available on PyPI. Use pip to install it:

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

Uploaded Source

Built Distributions

asyncpg-0.8.0-cp35-cp35m-win_amd64.whl (573.0 kB view details)

Uploaded CPython 3.5m Windows x86-64

asyncpg-0.8.0-cp35-cp35m-win32.whl (538.9 kB view details)

Uploaded CPython 3.5m Windows x86

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

Uploaded CPython 3.5m

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

Uploaded CPython 3.5m

asyncpg-0.8.0-cp35-cp35m-macosx_10_11_x86_64.whl (830.3 kB view details)

Uploaded CPython 3.5m macOS 10.11+ x86-64

File details

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

File metadata

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

File hashes

Hashes for asyncpg-0.8.0.tar.gz
Algorithm Hash digest
SHA256 0b512341c3552641f4aacd45cdf45c1ce7fdd9d01fa873840fc6a81a04f1b67f
MD5 d88c70a11ac9b421245229acd32e9634
BLAKE2b-256 5245cf921790d5f1c642cf4f38636adf8ab0ad0f055998925de1a42b6fbe4846

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 c2ad5dde26f3dc787e196dac4fb67e7b23b0a34db1d7fbe4bde015fa37977c62
MD5 03a4f69ed540f55855a09d7ebeb49639
BLAKE2b-256 9dfd0ce2a93ccdf4f8083b0f49b9f0f17fe2dda92ed5da743cfc932031a3b817

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.0-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 c2c85d038aa6ad241e7baff1f9d77888258afb4ef1daf993d1bc54e7c2c3ecfe
MD5 1f44e90d8c75833f6e05b9c792f8320c
BLAKE2b-256 b4533e3fdab8d52682cd190b3eb4ca342b8aabe944e3bc4a332d77ce7ee44e77

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6e5254e5a3d64ae9a22a685099ec63c984059403cafde2c3bb1170c3f63966ea
MD5 3fad9d80097b075c33f028f3cb15bd97
BLAKE2b-256 d6ec70bfcba4023a89376fba4b742cf2e6afdda35c8e06390385d6ab904e3fdf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.0-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 81b2c9d605bb679a8a3e119bedfd162842082a8cf7ffd5ed7aeb2bbe9c68ffb9
MD5 27da6efc1882a6f16d63029843f067b1
BLAKE2b-256 e55710171bf5c82109c5a1e6a24e397454267353ccfc7291c0a7d834acb9cb11

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.0-cp35-cp35m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 8eb968f261b97f65d626e22d77676fbfe0e86d3fc841db10c95fc3410f791672
MD5 61f6b12b99f1a0d949506d91c0147de9
BLAKE2b-256 be2ac30325aae74500f4fa0bfce829c31f980f774ea8057b5d40ebff9667a0c0

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