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

Uploaded Source

Built Distributions

asyncpg-0.9.0-cp36-cp36m-win_amd64.whl (618.6 kB view details)

Uploaded CPython 3.6m Windows x86-64

asyncpg-0.9.0-cp36-cp36m-win32.whl (582.5 kB view details)

Uploaded CPython 3.6m Windows x86

asyncpg-0.9.0-cp36-cp36m-manylinux1_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.6m

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

Uploaded CPython 3.6m

asyncpg-0.9.0-cp36-cp36m-macosx_10_11_x86_64.whl (711.8 kB view details)

Uploaded CPython 3.6m macOS 10.11+ x86-64

asyncpg-0.9.0-cp35-cp35m-win_amd64.whl (610.9 kB view details)

Uploaded CPython 3.5m Windows x86-64

asyncpg-0.9.0-cp35-cp35m-win32.whl (576.7 kB view details)

Uploaded CPython 3.5m Windows x86

asyncpg-0.9.0-cp35-cp35m-manylinux1_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.5m

asyncpg-0.9.0-cp35-cp35m-manylinux1_i686.whl (1.4 MB view details)

Uploaded CPython 3.5m

asyncpg-0.9.0-cp35-cp35m-macosx_10_11_x86_64.whl (703.7 kB view details)

Uploaded CPython 3.5m macOS 10.11+ x86-64

File details

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

File metadata

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

File hashes

Hashes for asyncpg-0.9.0.tar.gz
Algorithm Hash digest
SHA256 95bfd835f19c1b123bd5672e76d166d7a03fa6f64ea6b650f44ad9216bd9db88
MD5 c2c24de1ccd7990b49940f33ce55969c
BLAKE2b-256 4ed9942231219d4f576c45a1ad9903b2a8dad70706ab47819a55b25ddc8736a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.9.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 3fc4296e63dc14cf96ce3445178de5ed4435bb08e4924a58148bbff0e4686d38
MD5 e983854da9ac057d4c9d5efbd64246d5
BLAKE2b-256 e73f52a66e95241f9e1392ac90239edd5d2df9ed579e7fa9f53b46490884ae79

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.9.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 676bb6c8339ccfbe7fd2805084a6cf051dc4269ab4b9a2f69fb2ea4d98bdbcf7
MD5 8415952f23fa6b3996373f5d05f5d3c7
BLAKE2b-256 cd9b421d57d348bf7e67853b80f4f59893178edc230249295971347a2e51c0ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.9.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a3703803c62b7a233ab098a410d976065d3c57dd81617df4f4f478099b131abd
MD5 01a1234eb9143c79356a75435584c1e5
BLAKE2b-256 80ab04d3e678798f4b981c04708a60a33ba13d59fb50e72aec5aec9cb5dca8ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.9.0-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 1b803c1c16bbebc3feffa188b2c35d708d2b3adb2f0fbf3ce9afaf505fdd827d
MD5 811e93e7b3fea4d513093f113d7a4ffc
BLAKE2b-256 8c1ec033a30b67e2819526b763f37ca2ba1c7392cfdf9b400b55e33c367073a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.9.0-cp36-cp36m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 a06ef576f65f975182b233346c739e1cf21de321cc7f7d4994a4a5ae9d4c8eed
MD5 df37112bb8d29fa2a3483c08138c310b
BLAKE2b-256 fc8f04a6eeccaf2a02d06e0d1a5b997be8e5f2f4f637f7fe8baa9cc3f6a85f22

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.9.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 6890b80b0307e9a16c6187ee86f4db6072a8e4af71aaa59047d54e9f9c917d9c
MD5 d756dbe3ef7815c5020ba2f876afcb73
BLAKE2b-256 87518651d1d5886a769bc335910e8b797014d48b61dbdff3de4ce6af991a46d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.9.0-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 80a1d373549895eee178e57fc819ca65e9210b04a2d76156e1bab891f64fc0bf
MD5 3cdea75ade8263fe058ba4c858901fe0
BLAKE2b-256 5a183ac6cc325b128577742e042f7ac42940b6db088d454ffff5c58329093b57

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.9.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3ca234885de665283c5c496377d5e0ff75065b43e020701c0985095850acf61c
MD5 ef9ad9636bf96c79fa9c6608862efd12
BLAKE2b-256 6473bff72c60346eb8621c7f4a0c02d3491f46a67622345e4687877ee5d64350

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.9.0-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 eccfdbb223ca453e3374a815d30d98670f5853cf9504193c3e3e0509391690d3
MD5 10a48889e601497770aadd569d7e8526
BLAKE2b-256 f0a523f5bdb4e09b404ff777637647fb98c0eb40cb5b70725ddaac5f952cdd5c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.9.0-cp35-cp35m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 34196fac2d77c533683ae48faac1ed9e3a292e85e48c80c67ba01fc98b123410
MD5 51df752131e2bc3fde9d91a1e30d4473
BLAKE2b-256 7f1b3d835989da793fd1e2e98f766cce275ffa2310667dda8371589218d04a0c

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