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

Uploaded Source

Built Distributions

asyncpg-0.17.0-cp37-cp37m-win_amd64.whl (903.6 kB view details)

Uploaded CPython 3.7m Windows x86-64

asyncpg-0.17.0-cp37-cp37m-win32.whl (847.2 kB view details)

Uploaded CPython 3.7m Windows x86

asyncpg-0.17.0-cp37-cp37m-manylinux1_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.7m

asyncpg-0.17.0-cp37-cp37m-manylinux1_i686.whl (2.1 MB view details)

Uploaded CPython 3.7m

asyncpg-0.17.0-cp37-cp37m-macosx_10_12_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.7m macOS 10.12+ x86-64

asyncpg-0.17.0-cp36-cp36m-win_amd64.whl (903.7 kB view details)

Uploaded CPython 3.6m Windows x86-64

asyncpg-0.17.0-cp36-cp36m-win32.whl (847.5 kB view details)

Uploaded CPython 3.6m Windows x86

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

Uploaded CPython 3.6m

asyncpg-0.17.0-cp36-cp36m-manylinux1_i686.whl (2.2 MB view details)

Uploaded CPython 3.6m

asyncpg-0.17.0-cp36-cp36m-macosx_10_12_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.6m macOS 10.12+ x86-64

asyncpg-0.17.0-cp35-cp35m-win_amd64.whl (893.1 kB view details)

Uploaded CPython 3.5m Windows x86-64

asyncpg-0.17.0-cp35-cp35m-win32.whl (839.6 kB view details)

Uploaded CPython 3.5m Windows x86

asyncpg-0.17.0-cp35-cp35m-manylinux1_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.5m

asyncpg-0.17.0-cp35-cp35m-manylinux1_i686.whl (2.1 MB view details)

Uploaded CPython 3.5m

asyncpg-0.17.0-cp35-cp35m-macosx_10_12_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.5m macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for asyncpg-0.17.0.tar.gz
Algorithm Hash digest
SHA256 10efb357cf879f0e7e3ea4ea852b0b52877f208d988aeb626296092d2601e3cd
MD5 3264730b9fabe40201e55e99454a4abe
BLAKE2b-256 bb782a2a0fcfe9b0b08cdf5d03907251502fd127395d50c21f430a1645490293

See more details on using hashes here.

File details

Details for the file asyncpg-0.17.0-cp37-cp37m-win_amd64.whl.

File metadata

File hashes

Hashes for asyncpg-0.17.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 0b2efe8f3dce86d9c16aa6d7043e7496d99ee25e7390dacff660ed7b5e25060f
MD5 8365dc8fe37ffe0bd8c3faf4b2f8d4a0
BLAKE2b-256 cefb856187a74bdb2fae2849c4b595361fdacae9812428c1ee4bc176e17f1a46

See more details on using hashes here.

File details

Details for the file asyncpg-0.17.0-cp37-cp37m-win32.whl.

File metadata

File hashes

Hashes for asyncpg-0.17.0-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 8b507afc0f5657a4ebbf5270d00d27513935aabd78f07628353b2a778ec4af61
MD5 815661a39c9b3a51e36f5af140c8815e
BLAKE2b-256 7576061e7946be5ca869cb9b906f747a320b431e1a36cfbe7ad65be390a40710

See more details on using hashes here.

File details

Details for the file asyncpg-0.17.0-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for asyncpg-0.17.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a1522b0408195242068c5899d6ecb1efb818cee86dab514971463a67d395da06
MD5 e068f70e56f51396f1e254ad336b33ad
BLAKE2b-256 f7a177546cc018dd296a4f91a712b92549f9d9bafb2a17721dc727aaf6746eb3

See more details on using hashes here.

File details

Details for the file asyncpg-0.17.0-cp37-cp37m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for asyncpg-0.17.0-cp37-cp37m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 03dea4fe865cd21b5e5b6b575c582d09463c00ea0b137b323ebcffc114e7fefb
MD5 f2804203a289d23ac0d86d87a3fc687a
BLAKE2b-256 f2f5d50245522e5e7473aa4e190dcbc651267e2d2281cc8a6bfbf1906536e058

See more details on using hashes here.

File details

Details for the file asyncpg-0.17.0-cp37-cp37m-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for asyncpg-0.17.0-cp37-cp37m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 60a70530dda8cfd09edcea77ef328e37f1d189c00a48e22049f554ef58e5f06b
MD5 33078b9f6f6db860954ef885387412ee
BLAKE2b-256 ec46edd2b4d9cedcdd7cc5f3c86c1f030c28c9078628db2d83c28022be629045

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.17.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 bb5dd96503dff7e3038655e0c8946db9a6fd6b8a7307096ca48ad165c9cb185b
MD5 a350e14dff9e35ffaec4ae593bcfbfea
BLAKE2b-256 4ab087f81c271176d69e82e1383cba72dd07521cb870fa5fd12125a27f293d00

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.17.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 f003d4b2b887dd0661c94c80aeeca1410dc0aafa1e16652cde91e0b0c43b8808
MD5 0f5684e7a80ffb7455d5e039474c947c
BLAKE2b-256 8fa864299960cef62aa449af7e353abffbdb4b0efcdfe4ba518c7ebff554d2f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.17.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9b92d536cf5881b99aaa99ce7af4848a91a063127ef94044e4139fe530d88d8a
MD5 91d5ce7e4ef21a639869748d2a7367cd
BLAKE2b-256 ab9ae4cdeef51df4c12f41294fe2cd639d30ba916deb2daa8aed1efbf18a0a71

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.17.0-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 7adfabdd2683b4c7b7fe1e6fd46bd9873563c1ed41f12dd5f2f9b360af4c5ef4
MD5 7ca4c29c0c4aadeed31dfdb51d7557e8
BLAKE2b-256 09482305c4772bfb2418a1904cc4f69d2fe0bd8ee110b415a3ca8b29714ce39c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.17.0-cp36-cp36m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 323b1db6bf6c99be6a16e371c5dcf1fd7b1f32f22719e6f6305610347f811423
MD5 2e08999bbfe0fdb60f433705647dd8f2
BLAKE2b-256 4108d4367909ec59af2ee24cae3f09e7422557b4261ddc4f292ccbc4c8f59256

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.17.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 69af70030faa8b6ce00e921d38e076f58dbba251314d61cc71e479f8cbaa30a3
MD5 13fc004906a0ef6cdfa52c0219d2ebf7
BLAKE2b-256 706c428ce858a23e28eddd5a9e17744de04ecf99229d66147d0519a5badb6a2c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.17.0-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 b368229bf96f497a3369fb24ef6a32063b8ebd94e91a2781b6a49de6a08a3d77
MD5 28b0bae5920ac65dd859b76169d51f15
BLAKE2b-256 0be251ce883b6d2e9f0a7b007e6cf3e76d3ef3634220f56d523a1254e18b5ef0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.17.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b24a7451ca40af9a809012074289dba8ef403816bc1d4221a5aef3091389a729
MD5 833b22c1623692307d6ce17267ff8eef
BLAKE2b-256 be638d9adcd97a6b6bb0d720931496c7f520123e2f83c2a5c554b07dfe4e2628

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.17.0-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 2aeb44894fc8ce747f324200fddb2eb16709f420c44d94b445f8889152a5ab96
MD5 30b457292008bb239f7bbcd82f95819e
BLAKE2b-256 1a36f71d855d7eaf857f7693a79ba429fa149a0c4980dbbad64eeefca2e08b0b

See more details on using hashes here.

File details

Details for the file asyncpg-0.17.0-cp35-cp35m-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for asyncpg-0.17.0-cp35-cp35m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e9c5245837ce08f4cee2b01e639bed79abaebb0b39e4be573c1c7387ce2ff01f
MD5 d529630ff15a96e8296d9426e77e42c2
BLAKE2b-256 da082ba181c17b52ae5b92d564c3d9b09436058b3e6f56760f7e8c898d570712

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