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

Uploaded Source

Built Distributions

asyncpg-0.11.0-cp36-cp36m-win_amd64.whl (725.3 kB view details)

Uploaded CPython 3.6m Windows x86-64

asyncpg-0.11.0-cp36-cp36m-win32.whl (682.6 kB view details)

Uploaded CPython 3.6m Windows x86

asyncpg-0.11.0-cp36-cp36m-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.6m

asyncpg-0.11.0-cp36-cp36m-manylinux1_i686.whl (1.7 MB view details)

Uploaded CPython 3.6m

asyncpg-0.11.0-cp36-cp36m-macosx_10_12_x86_64.whl (797.8 kB view details)

Uploaded CPython 3.6m macOS 10.12+ x86-64

asyncpg-0.11.0-cp35-cp35m-win_amd64.whl (717.0 kB view details)

Uploaded CPython 3.5m Windows x86-64

asyncpg-0.11.0-cp35-cp35m-win32.whl (676.5 kB view details)

Uploaded CPython 3.5m Windows x86

asyncpg-0.11.0-cp35-cp35m-manylinux1_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.5m

asyncpg-0.11.0-cp35-cp35m-manylinux1_i686.whl (1.7 MB view details)

Uploaded CPython 3.5m

asyncpg-0.11.0-cp35-cp35m-macosx_10_11_x86_64.whl (822.1 kB view details)

Uploaded CPython 3.5m macOS 10.11+ x86-64

File details

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

File metadata

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

File hashes

Hashes for asyncpg-0.11.0.tar.gz
Algorithm Hash digest
SHA256 298ddf8339e6b38720f7b14a2618c864d758416d6247a0a98edad96ac297b0e2
MD5 5263a34110b297fe8f3e40788015be2b
BLAKE2b-256 788e390ddee06d07916c6b890fca53c0840264ddd24cf5b6917546e55b03e18a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.11.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 5cf404568ce6bfc133c04b9d050add79aa0ad3ec2fa8bf94b1fe08383b329941
MD5 2d697ae8402d760154341f8c16dfceab
BLAKE2b-256 4c44e061b60b72904b81fdd3fa3d7841ebe1dc39a83b62cd8095ec76489179fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.11.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 628bee76be9439a8562e9adc74dbc34600715b8294123ddc8a0b648debfed5c9
MD5 d4a8b9488c16d5821d5d7e1ba0c0f4d1
BLAKE2b-256 1a48ab0bff9c89c0c957d9eef0318404fe0f0c37168a18774195a1d7e2d2c8f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.11.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 58b7845fbc04b1b10e827ce33a028785784510d4544fc68056178c867e4cefb3
MD5 f5e00309a3f8b9eb375ea5900a86edcb
BLAKE2b-256 90f775f8e7d0d6d66504091e5895d6c1ea00ea1a1a77424414cb17ce4745e5cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.11.0-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 b1929929f6bcf8d16a4828614568a47784281a688b23ad0ecf7d667332d66b4b
MD5 456e6cf961fd12368ef83dd13107fb5e
BLAKE2b-256 38908299e793a015e6aa096563a189c9c317f8fa0f75444b79ed8bbe6397a5e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.11.0-cp36-cp36m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ad7c09a84a8bcb8c9b95d971f3171459722b486c75a767153eb7bb3f1eaa882e
MD5 2a0797c3d16d82a6d03a48cfa99fab34
BLAKE2b-256 a8983bc06ede34b1f05a3113d39fc798eddf930a149bd24582f233077e2090de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.11.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 98e59292ecc3b74314208978957ebfbcc0bf09b2b6b4d65005125960f3dcd276
MD5 721da0f4683e54e1374aa180e8a9d89d
BLAKE2b-256 7fc9520abf3c2dcbc18779fb3ab5cecc4538d05ecd70640ffa2ccbc811228593

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.11.0-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 2c5fb72c8638be531a0e6a401a2c5994d10aa690c302b09581f7214ec1de852c
MD5 64ad7302043dea82977883915288e930
BLAKE2b-256 57fe24f6e1f2ef8eba29ae1a9e170bb738ec058f84ca641c498eb54f37231f31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.11.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8fbb7f068e48c3bdc3414486731a76b5a62df7c403e1d127fc64571adb05d3cf
MD5 ab6789edb1534a558f794c2d567ce917
BLAKE2b-256 b93e9e33d9da92830fb4dcbe5afdecfae37a4f36212ff3063f7b3a66f81e4b6e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.11.0-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 75fb47dc14e297f7f46274e5d33a549a82e4d601323998b0da4c2e6103c6ad45
MD5 8cc026f4d27170750987fbbf715899d8
BLAKE2b-256 d7f7e6c6a7e4a8ab718123057ed98d610a39cf3d6888f61b72d38d8e78aad09e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.11.0-cp35-cp35m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 d77fdb18e1bbf378f59fcef19c9d0e1cd2ee837f80377e4bc31a195cd4b66f35
MD5 6b84ceb1b2a79916bd91c93d70edf992
BLAKE2b-256 f397e63f2c24c175a6d7b22a04afacf58958b73124c10fafa0e0b3e6858255d7

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