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

Uploaded Source

Built Distributions

asyncpg-0.12.0-cp36-cp36m-win_amd64.whl (772.4 kB view details)

Uploaded CPython 3.6m Windows x86-64

asyncpg-0.12.0-cp36-cp36m-win32.whl (726.8 kB view details)

Uploaded CPython 3.6m Windows x86

asyncpg-0.12.0-cp36-cp36m-manylinux1_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.6m

asyncpg-0.12.0-cp36-cp36m-manylinux1_i686.whl (1.9 MB view details)

Uploaded CPython 3.6m

asyncpg-0.12.0-cp36-cp36m-macosx_10_12_x86_64.whl (850.2 kB view details)

Uploaded CPython 3.6m macOS 10.12+ x86-64

asyncpg-0.12.0-cp35-cp35m-win_amd64.whl (762.4 kB view details)

Uploaded CPython 3.5m Windows x86-64

asyncpg-0.12.0-cp35-cp35m-win32.whl (719.1 kB view details)

Uploaded CPython 3.5m Windows x86

asyncpg-0.12.0-cp35-cp35m-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.5m

asyncpg-0.12.0-cp35-cp35m-manylinux1_i686.whl (1.8 MB view details)

Uploaded CPython 3.5m

asyncpg-0.12.0-cp35-cp35m-macosx_10_11_x86_64.whl (876.5 kB view details)

Uploaded CPython 3.5m macOS 10.11+ x86-64

File details

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

File metadata

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

File hashes

Hashes for asyncpg-0.12.0.tar.gz
Algorithm Hash digest
SHA256 729e9ca808550bc3aad6e6266ea71278faadeed726a9dc72c6d203c1df0a737f
MD5 c899a0cf579ed2cb9b31d50bab124ab8
BLAKE2b-256 742477533aa7e4a4b7ac4020832153a9ece48bc165abb1447e8b030305754112

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.12.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 09de06571b9a3d3952f4f3af51616d6147175e71ab07a15fb45c346b34fa15cd
MD5 fdfce48d6f15764a05d8794e198a6a8e
BLAKE2b-256 3c0ef560b4789cdfd9173a86a53c42a014ea1e2a42b680091afce2a6230d9b1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.12.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 08826af6a695c9ddc0379389306cde3cea791ef43e6ddd487730434c3f0739a5
MD5 2fe00c6a710be81a95662c0ecbc57019
BLAKE2b-256 bde4b325b866ca0718b6828f134eb2433caec3386e6b56dada1ff3a4cbaf5e52

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.12.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f1e3c025360d6dbbb4d02d03754dbe5abc3417b0d0f199f2fa07d618e6269c88
MD5 129cfe36f909bcd22f5a703b555c74f1
BLAKE2b-256 5637bc6422d9abc0495d57afab73b16c4b886c536fb84edcbb319da8999db196

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.12.0-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 497a34634119292081f5af51fcbeee5664bd2a8732f995da27eeec703987c479
MD5 3221005802cb78bbd0ee7b6ae36fc3b6
BLAKE2b-256 9754d62762ee0bd79834bfed4121605a6db8fa5bdb8b944a86f28ec7731d9923

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.12.0-cp36-cp36m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 905640bb67a1aa1d2520337a0efa6f2c20c63239844e2f5b008fc3bf33789b85
MD5 9c863dc9df283f27262bf8900139fd5a
BLAKE2b-256 456dd451d88106d8eddf3d5b0313d7befeabbfbee96269b5b0ef815938b0585c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.12.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 0d0439d7d67aa078faf8dc366d4c2127c755e1af0d13cbaf481a2a74e24a07bc
MD5 f7b694527c869948784759739ac161c8
BLAKE2b-256 aa4056165b1fa8b4febd2c2db118ef08caada298fac4fd3dab4dfe4aa2651591

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.12.0-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 cb3a198a9ab291cd0a710a2fd604d64a3154953dfff84cc0c17ebffdbe217bc1
MD5 5118d9093e17d467889a81c3b7ff30ce
BLAKE2b-256 1b091cedf1e28e863aef61da01af4d322a9677dc1a83b09579199c5a1cd22108

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.12.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 59c45125e569ab9a7a96fd4476e07deab8719c214991210090c37150a5157fa6
MD5 d742443f8e38ec5d77999c94bb238c60
BLAKE2b-256 dc5ab319b43d6bcc3ce4e3407b2eb3297e46d51f8797d0b224fdb5af0eb49c86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.12.0-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 702d6ae74035854e3754a7fc508d49adec54a34026eaa39ab6938402a73df730
MD5 1ea67704cdbf52b33b2595317ee2072b
BLAKE2b-256 c43b1a68f4f08e2921c17c255acb32011184de0f546fdf24085ae8caa1c7b262

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.12.0-cp35-cp35m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 0a07fc0178b080abd097248d89b0ea400f5caaa95a41d91e9ffea5eb8286c426
MD5 480b50f9eebc36c3a831fe1f022d8ce7
BLAKE2b-256 7dacb3cad3dfa039fe809f5451d32460a53868c3a4ddcdfe5d1ad4457cec5595

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