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

Uploaded Source

Built Distributions

asyncpg-0.13.0-cp36-cp36m-win_amd64.whl (862.1 kB view details)

Uploaded CPython 3.6m Windows x86-64

asyncpg-0.13.0-cp36-cp36m-win32.whl (808.6 kB view details)

Uploaded CPython 3.6m Windows x86

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.6m

asyncpg-0.13.0-cp36-cp36m-macosx_10_12_x86_64.whl (952.7 kB view details)

Uploaded CPython 3.6m macOS 10.12+ x86-64

asyncpg-0.13.0-cp35-cp35m-win_amd64.whl (851.8 kB view details)

Uploaded CPython 3.5m Windows x86-64

asyncpg-0.13.0-cp35-cp35m-win32.whl (802.1 kB view details)

Uploaded CPython 3.5m Windows x86

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

Uploaded CPython 3.5m

asyncpg-0.13.0-cp35-cp35m-manylinux1_i686.whl (2.0 MB view details)

Uploaded CPython 3.5m

asyncpg-0.13.0-cp35-cp35m-macosx_10_11_x86_64.whl (985.4 kB view details)

Uploaded CPython 3.5m macOS 10.11+ x86-64

File details

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

File metadata

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

File hashes

Hashes for asyncpg-0.13.0.tar.gz
Algorithm Hash digest
SHA256 f5d59fdde5b26f0f56db82906606344e9b5c9804efd50dfcc858862625dcf858
MD5 aafecd7190ecfd16cf195d1e6992f9eb
BLAKE2b-256 1c26be07387afa41552a1c9d4860ac3ae31eb08cda506c84f7c49b5bda25dd0a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.13.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 a1b79091f53999dd4ec7fc02ccebb039174559efc65ea80ae0f18cf723c94881
MD5 1d10d586e870c346120ad8ae853693ac
BLAKE2b-256 114a9bca71e9cfce778d96ed48c1c0c9b3f42bbde951adf6d65054fec157a326

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.13.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 d77e9301723eaeeba2ec545dc46e4b6aac5d31e808a0a80ac7900cd2c66462a6
MD5 31937ecf9bc8ce1c6cc8b59a3309a648
BLAKE2b-256 d0a6dce91914118aa96573e3b00dd73c57d43250989d2d2b2ee19a70775b2a41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.13.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 20cf32e69c13b0603b1525965b8c2766dac1989c7e0cca7b40e3975f1042eeed
MD5 028dbf5992516bb8fea66b6385fd48ec
BLAKE2b-256 d3de665a39f9eb1814cc71becf8848ce93d2c5c680af75a541b07f28388be406

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.13.0-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 bc254d6c8cb9c23b281e076b4e72b15854a39aa1f08baddfa933f3773e124600
MD5 f4d176bf4bcdb0b90fb8c60aa8994d15
BLAKE2b-256 1ea36d99da8cb23b312dd98eedc5ccdf93bb4b2952fdcc2cc8903fd47fab971b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.13.0-cp36-cp36m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c5c88f87aa7e58e1338df4338965ffaefef3bf2ebd64a90602f539dd756e7416
MD5 c72100c98a637c86729b7e1c578f7220
BLAKE2b-256 3e98c0e0072d1bceeec64e883952a3e130fb4a129a09b1c0eb5ad278809f0a5d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.13.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 85fa780604cb63500f4e7579230b0c2e3e9db591cfadd96bd8a6a4c0b6a0b3f6
MD5 9e58d76381179d04a60102e82d92621f
BLAKE2b-256 675feaf41df8a5a0c194815eb92e57a5b0ea9612fb8cd32cf2be6b8e679b83b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.13.0-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 88d440fef2a61cbd97add25970aec124ed0a7eb57afc7f3c219ebf2d80fdf967
MD5 c67d6168a0580d60d72170028e649065
BLAKE2b-256 6bf1c9411e613a144a83c9894aecc11ddb0941a3e500851748a92786990c1227

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.13.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e5e322a1f8208271ef101f35a4ca9c517a87180452ca63f1dfa6d3d4b08dc46c
MD5 bb89f58d0809b2b4f68e21ba067a137f
BLAKE2b-256 00ac1640deec3b53e77373c5722dca7ff62e7e47575d3f558ef1fdffc620a34f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.13.0-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 0755224e9a0a02692669471f9335844cd7ab71aca4a0d53460a2e82329702fbc
MD5 f93812a6731735ae418d1189d639ff40
BLAKE2b-256 c361dd8f92d989572d493e8c87379103e4fbe77588e10b9652feb9489fab79c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.13.0-cp35-cp35m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 3c04bbd4352eaa68e1a6f0923f8e45e512d4fab32f047ae7549b3389f948efd3
MD5 51e450254dea34ee8615f01b1a7d15c3
BLAKE2b-256 b2dd2759fc171ec41bc65654a88d862f48658faf53408b2f871fdf7162a23187

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