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

Uploaded Source

Built Distributions

asyncpg-0.10.1-cp36-cp36m-win_amd64.whl (651.0 kB view details)

Uploaded CPython 3.6m Windows x86-64

asyncpg-0.10.1-cp36-cp36m-win32.whl (612.2 kB view details)

Uploaded CPython 3.6m Windows x86

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.6m

asyncpg-0.10.1-cp36-cp36m-macosx_10_11_x86_64.whl (747.3 kB view details)

Uploaded CPython 3.6m macOS 10.11+ x86-64

asyncpg-0.10.1-cp35-cp35m-win_amd64.whl (642.7 kB view details)

Uploaded CPython 3.5m Windows x86-64

asyncpg-0.10.1-cp35-cp35m-win32.whl (606.2 kB view details)

Uploaded CPython 3.5m Windows x86

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

Uploaded CPython 3.5m

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

Uploaded CPython 3.5m

asyncpg-0.10.1-cp35-cp35m-macosx_10_11_x86_64.whl (737.6 kB view details)

Uploaded CPython 3.5m macOS 10.11+ x86-64

File details

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

File metadata

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

File hashes

Hashes for asyncpg-0.10.1.tar.gz
Algorithm Hash digest
SHA256 b5b15bc1de8926d6cf4f800b434c8c101671e37a3e5acaae858670c9066c31a1
MD5 66da3fee62ecfe0cd2fcc54fdee704da
BLAKE2b-256 65ec73e7861d817d467c61e83555ac1796bdeb4800f1e68c89bd33ea6df8101f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.10.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 d7be286ee39a55769bf63ec84a92b5ef8d361ea2a976c3baf14a179702171693
MD5 f84aa7c566fbbd2ed280dd9c81c98e81
BLAKE2b-256 df767ff53d423d3017c4ff5f43216eab8fb3cadc29e910be35169d24f69cc14e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.10.1-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 4e8dea4f5879122a8f487e46290d88c7d9a190f3c726afc11e36f2100889c139
MD5 d8920dc973a161519792bd39cb6bba8f
BLAKE2b-256 0f36ab2aea52ab72759465eca8f194bd3fb0635927ad7497adf8870a2c1b84ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.10.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ff955dd6d63ab58d41dfea155fed7fff43aa6eb41df48982050daf0388e24db0
MD5 2e258a51253f426c125891400fbcc3d8
BLAKE2b-256 52882dc00effbc724a341255b31ab6c91b7db3ef6f4dd6d68656b33742390850

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.10.1-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 3a8266e2489d8124631737bd72e4f989a4f91e0172d018d3e1d91a9d9c2e06c7
MD5 bebe93945ad9184d3139b49f04dae206
BLAKE2b-256 d73f46ee877ca91312a182280b37e810c9690f75b802649edefab47d7526ef6a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.10.1-cp36-cp36m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 4df42cfcc17c50a1c1cd5db101697ad8870653f33275f45b99caceab1b513838
MD5 548c28d37c3434320bdc469312eb606f
BLAKE2b-256 f1cfc285dea2ba8c9f96647c38d479f905b8bc5d183ef6c14e6607ac42ea897b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.10.1-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 c123c365cae65d7952039d109a653817508810d032a15b5d1155db807e6f937f
MD5 89037231b9fead78c26ff14957113c27
BLAKE2b-256 db05c8c79026db2ad00e4408928d2e76748594d6157f9cdc99ee4fbc5151622f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.10.1-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 ec573f4605077e1d5be0a82404eb05af98b381ffbcd6ba873c24a11e92039e85
MD5 37641d7cbaf972455dc4fdcf43dc924c
BLAKE2b-256 415cf7e81c8decaa8cecbde05256eac18328a03c01601608134f7d2ff8357b42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.10.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 669e2dfc5fd1e4d2f0c763d49b8b4099cb2c9f504169fe4fe604d55c0703b4da
MD5 cc6d13550cfe3097f7d89b01c8575b2c
BLAKE2b-256 f3c7d0c530bd86d7a48bec7e54f22bb93abe6881e86ffe30fbc9730bc30d089f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.10.1-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 d1afbe00b80fab3d25bd73cd0364009e399a38bcc776a10fbf377ee44ca87f29
MD5 df6accee806518b8a09656f9c9ea8905
BLAKE2b-256 48334d74107cce2ec2bf6d7a157a9ab5485c05d4d65ce8add370cf3ce550f19e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.10.1-cp35-cp35m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 e79049dc1253ff1c7a8f7ebad86205a8c08803795a57c7ba76276da3694f9409
MD5 0cf43055263b2e9a9546aa045312c73a
BLAKE2b-256 503c03028953cd76696a8a2e3d407d2fe82989518a45bcdd28f33ece0c083e10

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