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

Uploaded Source

Built Distributions

asyncpg-0.10.0-cp36-cp36m-win_amd64.whl (650.6 kB view details)

Uploaded CPython 3.6m Windows x86-64

asyncpg-0.10.0-cp36-cp36m-win32.whl (611.9 kB view details)

Uploaded CPython 3.6m Windows x86

asyncpg-0.10.0-cp36-cp36m-manylinux1_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.6m

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

Uploaded CPython 3.6m

asyncpg-0.10.0-cp36-cp36m-macosx_10_11_x86_64.whl (746.9 kB view details)

Uploaded CPython 3.6m macOS 10.11+ x86-64

asyncpg-0.10.0-cp35-cp35m-win_amd64.whl (642.3 kB view details)

Uploaded CPython 3.5m Windows x86-64

asyncpg-0.10.0-cp35-cp35m-win32.whl (605.9 kB view details)

Uploaded CPython 3.5m Windows x86

asyncpg-0.10.0-cp35-cp35m-manylinux1_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.5m

asyncpg-0.10.0-cp35-cp35m-manylinux1_i686.whl (1.5 MB view details)

Uploaded CPython 3.5m

asyncpg-0.10.0-cp35-cp35m-macosx_10_11_x86_64.whl (737.3 kB view details)

Uploaded CPython 3.5m macOS 10.11+ x86-64

File details

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

File metadata

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

File hashes

Hashes for asyncpg-0.10.0.tar.gz
Algorithm Hash digest
SHA256 c6834617cd647d8ed553699ac663efa03c3b75445032f3c3362a814a1928825e
MD5 154c397910f588cb4eb79b204f1a8bb4
BLAKE2b-256 35d80729a0b141fdd4a38ce0f279b0068e2220b6f7d942427007ad6f5a86133d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.10.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 054e3b8432b2196b113c69a833f7690c54d8003fb560c185af22d0be122a8d90
MD5 3255aa46d9d49c664e5a9e1ebf39dc2a
BLAKE2b-256 b8a48e5340c646732a7c392102556ce6df4644d92a3d60c0130ee15f7a281b87

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.10.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 4272d5b05d5323a09ad08375295a67b0583a8168ff65ae869fcb4082707ea61e
MD5 276ae0474517f22a78cdad4288828ebf
BLAKE2b-256 0226038e0028a674edf6e47feb26a4eb6cb3a6abea863b415cde7e24a1f6089e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.10.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b7a2440358dfc9ca58666d27ee16f375c775d2f6cff4c3a64aebea820410d79b
MD5 eeacdf07f88f382ff555463f1a69e295
BLAKE2b-256 5c89377a231a5ad0adab6884c7c89d7ca737b293cbfcf105ee781ea8c43978be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.10.0-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 f71ec50451a2a505ffaff0af918ccb5147f7eab9650fa216713047e1c2ea7d61
MD5 900928b4b30b3574fe56dfed8444471d
BLAKE2b-256 0cb52c7454ebeb4ecfe778af635ff3dd98c7b94dc161c942a323cde3f0582c22

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.10.0-cp36-cp36m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 89d09fe325db37f8ee849f31da4c1cc3a98d3c3fa06985514b2ea437c8139164
MD5 7e4ccd8f246fee162713295834b5f867
BLAKE2b-256 cb60916a5ab20dc8c3a002a0cb51dc7c6330cdbd50a257d5e135b01621e35543

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.10.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 3b2c5f7360b723fc097dd2ac90614f47ad103ce250fcd9191647f8dabe3f6e49
MD5 ff2825cb0a96174ecd016877feeacfb6
BLAKE2b-256 ffb46bbfbcb336dee5994f1365ff4cde7799356a4c1fef4afaf36f3f424f481c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.10.0-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 e06a6d09239f09d1033695bad38ff2c82f910a400b06308735e61eeccbc2e4cf
MD5 201f3b0caa0273a954a311effe91b068
BLAKE2b-256 8668bc7494314708e39d1402dac6a774349240f7f5ac77e6e69b02003934b388

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.10.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6c87b76fe9f098dc9501dc9af42e63ed0bc8d6f03abf13cd0e5bf9dff88037d5
MD5 5fae17c97ad74f6481e288d36690ddb0
BLAKE2b-256 13689dc981742f9a3d63445a1db0ec5641edca919a1dd82889dd607a7b1141e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.10.0-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 0be9a9738c5dd2facc1b78b5e7129fc73dc2f947d38d04c412dcfa9ab61b9513
MD5 66db5baf3f692a91e4c5f19d03a9a0b4
BLAKE2b-256 5fb06da575973b25e86601e19b67d55ddc53ce2bf56550b5a010c50a96b2a940

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.10.0-cp35-cp35m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 eec09af1113e4551a0f424bb5f64d2c0428aff17074d72c6e5d529bf4ff80eaf
MD5 829a0776142ab27fd3a5f1390992dcdb
BLAKE2b-256 3bc1e72c0049350fffb128bad0edf1a55f70f8c1903c5d342d3d279eedb1a2b6

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