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

Uploaded Source

Built Distributions

asyncpg-0.15.0-cp36-cp36m-win_amd64.whl (880.9 kB view details)

Uploaded CPython 3.6m Windows x86-64

asyncpg-0.15.0-cp36-cp36m-win32.whl (827.3 kB view details)

Uploaded CPython 3.6m Windows x86

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.6m

asyncpg-0.15.0-cp36-cp36m-macosx_10_12_x86_64.whl (972.9 kB view details)

Uploaded CPython 3.6m macOS 10.12+ x86-64

asyncpg-0.15.0-cp35-cp35m-win_amd64.whl (870.0 kB view details)

Uploaded CPython 3.5m Windows x86-64

asyncpg-0.15.0-cp35-cp35m-win32.whl (819.9 kB view details)

Uploaded CPython 3.5m Windows x86

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

Uploaded CPython 3.5m

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

Uploaded CPython 3.5m

asyncpg-0.15.0-cp35-cp35m-macosx_10_12_x86_64.whl (973.9 kB view details)

Uploaded CPython 3.5m macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for asyncpg-0.15.0.tar.gz
Algorithm Hash digest
SHA256 491ef1b6c7fc2cd054b937cbe836022d140ae920e68f39b90d78efc992631b97
MD5 6882afd2ac976043eaeb2fce2848c3b8
BLAKE2b-256 e20ad9b7991e06096ca73ca14806478e3fb76dbc14ae6bc2ed688217cb03188d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.15.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 6c375ba41b98b775fee348436b72ed4170a6f9f7dd960f425b56601af63c00e7
MD5 4f6ab9b845664bb92021e84e6e5c8a0c
BLAKE2b-256 b9f38ce6dd410c7ccf6128c6bddaaf3d9303209ed6ec3d84b4faabf4c9ceabb7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.15.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 c3ae6c33de0e0011b7b3b4f61273c5be046a623e8e6546e7c7c8c08079fb7c8b
MD5 bff88b16ebc9ac224e414df4c341461a
BLAKE2b-256 2eb0fee6a66c4676a871d54a9d962680e3cf9e24d279ee3a25be05e340a44ef2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.15.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 99e8cc315f4c5592b9758064489a510b4660b354c302aaa0a8616af93195c1e5
MD5 3f7acf14e630a99d0a241fa693e4dab2
BLAKE2b-256 cccd5533b91a8dbf5f5fcebd564a09a96590d86c2f93dfa0fa0ecb803fa7c805

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.15.0-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 455d19f5efb37aa281ad5162efd981d791504b76257a9dc732c548ddfb89ccd2
MD5 078ed78f3d4c462d6ab6cae91bbd959d
BLAKE2b-256 c3ca55fd2e62465c18a791fc3cc654c1e22aac2b2733d1aee6ee0d7adfef3422

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.15.0-cp36-cp36m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 83d7759993d36bc7a99509acbafd26a77d0a910d333e5e8ed5e43a5552a4ed15
MD5 b3cfa3ea57a5c1d036f7dbf4bf0c7c09
BLAKE2b-256 836f9500e795f984e4f05e0ee295e008016e17d0a3815126dfde91ad92ddc522

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.15.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 02e649095049356cf40badb74fb682943fc05d5fa51c6a7d8695787654e095db
MD5 c4f48bf6edf745def6d4daa40fb73c00
BLAKE2b-256 02b99d1d724fabdb3427b4e564127c0d4bfec68c4a2ae6a64deab0099a8fe015

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.15.0-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 20299847f10aa50deb47dcaec7a7903bdd13729c85c5a8a00462eef735e30691
MD5 87720d839904f0d4747c38648328aefb
BLAKE2b-256 c9ea488673acfea04b515689da74e92d649410208e54e3a052a7531939200825

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.15.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6227c47ad43f4ead2fada7ed5643c41c27fe9a9ebf61df30d4ed8ecdca4b0f89
MD5 35f226ec8e025027cabf1c136d54cd70
BLAKE2b-256 0128cb128f20222ef6fba3e358d71018b2a7d88a324713691c9b785eb0bd3c7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.15.0-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 51dc680dc19d226bd42359ecd373e8003bb84f5130633fac1dbf6094344a6583
MD5 23e2ade23cd208c81412d4e30b11772e
BLAKE2b-256 2509ea7865f382d9501402048408a34271a57e6038985a349ce23b7f72d93961

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.15.0-cp35-cp35m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 292d9827f9db1acb681c5aabc9df02c5bf6cf58dfd733b3319d37451cb67c86b
MD5 5d91e35a190fd065605ccf983ba4d814
BLAKE2b-256 36794f85fbec97f78a50576a83b31f1bf61d9600f1f8af7ef9b352e5f389f185

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