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 11.

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

Uploaded Source

Built Distributions

asyncpg-0.18.2-cp37-cp37m-win_amd64.whl (973.4 kB view details)

Uploaded CPython 3.7m Windows x86-64

asyncpg-0.18.2-cp37-cp37m-win32.whl (917.1 kB view details)

Uploaded CPython 3.7m Windows x86

asyncpg-0.18.2-cp37-cp37m-manylinux1_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.7m

asyncpg-0.18.2-cp37-cp37m-manylinux1_i686.whl (2.3 MB view details)

Uploaded CPython 3.7m

asyncpg-0.18.2-cp37-cp37m-macosx_10_13_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.7m macOS 10.13+ x86-64

asyncpg-0.18.2-cp36-cp36m-win_amd64.whl (973.2 kB view details)

Uploaded CPython 3.6m Windows x86-64

asyncpg-0.18.2-cp36-cp36m-win32.whl (917.8 kB view details)

Uploaded CPython 3.6m Windows x86

asyncpg-0.18.2-cp36-cp36m-manylinux1_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.6m

asyncpg-0.18.2-cp36-cp36m-manylinux1_i686.whl (2.3 MB view details)

Uploaded CPython 3.6m

asyncpg-0.18.2-cp36-cp36m-macosx_10_13_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.6m macOS 10.13+ x86-64

asyncpg-0.18.2-cp35-cp35m-win_amd64.whl (957.0 kB view details)

Uploaded CPython 3.5m Windows x86-64

asyncpg-0.18.2-cp35-cp35m-win32.whl (904.1 kB view details)

Uploaded CPython 3.5m Windows x86

asyncpg-0.18.2-cp35-cp35m-manylinux1_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.5m

asyncpg-0.18.2-cp35-cp35m-manylinux1_i686.whl (2.2 MB view details)

Uploaded CPython 3.5m

asyncpg-0.18.2-cp35-cp35m-macosx_10_13_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.5m macOS 10.13+ x86-64

File details

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

File metadata

  • Download URL: asyncpg-0.18.2.tar.gz
  • Upload date:
  • Size: 662.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.2.tar.gz
Algorithm Hash digest
SHA256 22751a565c6e559d968565f2a4ed5803260f107171ed5cb81304573c13138438
MD5 9f4323330213f92a453ea5689dad044f
BLAKE2b-256 44b20d95bb5f2404103cb5e1a4ff50a355ef6b80efd8455e0aa3da6afa2603c9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 973.4 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 08a0afa32588a04581975fb09dc7c32a873e84481347d8701aba2c4360b70253
MD5 5e1ff6ce6e916b796645b80e252187e7
BLAKE2b-256 2cf89b6ee5660e91975060c987223c10bb569f594e98ba6d7bc0b9cb00d84b24

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.2-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 917.1 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.2-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 6c18bddbfc9cb5ce4bf41fc273a964018d6b9a5db144f927aa33246125b09d5b
MD5 4e5ef2778c8d6a15a38781dcef8abd49
BLAKE2b-256 2350b42e4dd623968c006304d2837b3d2c9b36fa7b39f3881eb4c1d9d23c4b8a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.2-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c8523c518a9db479b85b9d756d38afe946fa1727ffe6976b2e6fd856e0716e20
MD5 45ef9bf51c461100b00ec1723b9168a0
BLAKE2b-256 712e07a328af8046d43209f4a6617a13cc926fa46a0a2ce61fbada9bf55cf494

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.2-cp37-cp37m-manylinux1_i686.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.2-cp37-cp37m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 0f97e1bbc3a89508e6c7458b5145c540c9ae8fcf2be08807601701a7e0e61e6f
MD5 1d20f48800d6b1bdda1cd6fc5a6319e0
BLAKE2b-256 15cdd9ace68e4fe11d55159f616859330b4c89dd3648631ea4e3fa32cfe14651

See more details on using hashes here.

File details

Details for the file asyncpg-0.18.2-cp37-cp37m-macosx_10_13_x86_64.whl.

File metadata

  • Download URL: asyncpg-0.18.2-cp37-cp37m-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.7m, macOS 10.13+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.2-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 0b5b6d17d5e160e6c3b28f07b770de4ad464483ae2d27863973547e9b754f752
MD5 3618ceeabb7f9cbc668b899ce2faea21
BLAKE2b-256 ab644cdd856a6f21044976fad9b4cf1dc020884abec22b7c8a374a345628bb0a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.2-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 973.2 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 4534b146687e737acb56051ce57040454d79c017281b1bea82610e34aac6a9c7
MD5 2e57502f3ca81e896dfcbcfdf11045f8
BLAKE2b-256 325af82b76ef64e06fce0e5606b49a5feebb5fbf8ac814f3838b6104003ff252

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.2-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 917.8 kB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.2-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 eb1d1951fa6842884c0f3d520b74fd7975d48cae7d3561ae24cc348fbd3dc677
MD5 9986d4a37e1222f93d73b5bcd7b6e666
BLAKE2b-256 a8f130cca5cf4f20f09ebd4af95e04b8d8f93e00d12ea0901a872f4effb46486

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.2-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 58d36d6cd77ac9ca55a9f0ad96dca859e51debde2ba62b3274dc897a1dce81ea
MD5 65ac2e43e4b40add5716061b579069a4
BLAKE2b-256 005305d604410341cb7720e7fa115810d5bdd34ac31d4936d5958a54b0cccdb2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.2-cp36-cp36m-manylinux1_i686.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.2-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 60f45ce145d9eaba8f8382c9c2003ebcfff19db8cfdc1fc26e61387bc9d4b378
MD5 3012db1eb6338010c7f0cad8ba684fbb
BLAKE2b-256 5fd52f96a54f9fe80372ec542df611624a683cd0d64d458ffc0a489fe9283cd3

See more details on using hashes here.

File details

Details for the file asyncpg-0.18.2-cp36-cp36m-macosx_10_13_x86_64.whl.

File metadata

  • Download URL: asyncpg-0.18.2-cp36-cp36m-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.6m, macOS 10.13+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.2-cp36-cp36m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 6b3f1edf5dd3a9b332d34207101d2e2921beb194b9f41a50a2b669280c695a52
MD5 ed670b0b2e023b05c88ed91a6e2c5915
BLAKE2b-256 0990d6ed708e30a8b939a4dee837d4b67ca4aa2aa2d7c8a21b0720319028cc0b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.2-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 957.0 kB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.2-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 14892f2d715496da3d46b5ea968e48a30d6de15d60ae8e8d1e00605120b0d2b4
MD5 d26c4ccd2df3135f84ae99e70ee758bf
BLAKE2b-256 51ce8b2c79392e1da0d485b3fab5ae81da0b1d9c85a8370e9d6c271b4dc64957

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.2-cp35-cp35m-win32.whl
  • Upload date:
  • Size: 904.1 kB
  • Tags: CPython 3.5m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.2-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 9c730d9ac150cbeae07d9773451150c06b8797187a72b936fbfe349337ff5fba
MD5 9e32d43c754c64c158c2599218f2ae8b
BLAKE2b-256 60a60927540d721142012f96b8c275898d306e7268e5839bb6662210909bd4d4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.2-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a50072efe844f7758253b96c0878364725a412c23070253dba44719124b6bbf2
MD5 e38957b06f4b700836cda0f2ca1feb53
BLAKE2b-256 178afccb7e6c74af7a95a7ab15f3a14cef1b3daa46dc7318d5ce08c79e17ec8e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncpg-0.18.2-cp35-cp35m-manylinux1_i686.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.2-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 7540f66f8dfd3a46cd146fc459dd331dd16ea4c7ffb882434d58e334e3d93f7d
MD5 9ac9b44eeabc296183ea1dbcd7339e7c
BLAKE2b-256 ec13cc76adeaab5a75437d758d7946fc68dc77df361cacb29c84e7f68ee924ba

See more details on using hashes here.

File details

Details for the file asyncpg-0.18.2-cp35-cp35m-macosx_10_13_x86_64.whl.

File metadata

  • Download URL: asyncpg-0.18.2-cp35-cp35m-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.5m, macOS 10.13+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for asyncpg-0.18.2-cp35-cp35m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 8863143f8ffa3ebe690b23ebdf3667f1286478e2dccdd4da94fb0403276be4b1
MD5 e225a1c955dcfe0c392ef7d7395a57ee
BLAKE2b-256 f582102b216ff32506a07eac01ac69245b9cce5d39e948292319b2820d5edf9a

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