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.
Documentation
The project documentation can be found here.
Performance
In our testing asyncpg is, on average, 2x faster than psycopg2 (and its asyncio variant – aiopg).
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 requires Python 3.5 and is available on PyPI. Use pip to install it:
$ 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.
Release files for asyncpg 0.5.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| asyncpg-0.5.3.tar.gz | 344.1 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| asyncpg-0.5.3-cp35-cp35m-manylinux1_x86_64.whl | CPython 3.5 | CPython 3.5 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| asyncpg-0.5.3-cp35-cp35m-manylinux1_i686.whl | CPython 3.5 | CPython 3.5 pymalloc | Linux glibc 2.5+ x86-32 | Details |
| asyncpg-0.5.3-cp35-cp35m-macosx_10_9_x86_64.whl | CPython 3.5 | CPython 3.5 pymalloc | macOS 10.9+ x86-64 | Details |
Total release size: 3.5 MB
Release files / asyncpg-0.5.3.tar.gz
| Download URL | asyncpg-0.5.3.tar.gz |
|---|---|
| Size | 344.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b874758ca2369655917214f5177a0b512ad909dbd908d49ca6e791d6fc82a136
|
|
BLAKE2b-256 checksum How to use checksums |
d902f14375a6f16d9cbe54dce8f36e632cce18c50f8337fefe1f47650c51ec35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / asyncpg-0.5.3-cp35-cp35m-manylinux1_x86_64.whl
| Download URL | asyncpg-0.5.3-cp35-cp35m-manylinux1_x86_64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
7304bf463c02e8d61f0142835dc45dbd38ecf65a272cfb985e69fed47fb1e371
|
|
BLAKE2b-256 checksum How to use checksums |
168454fca594375bc11814653f3dad214d896f8af5e1071b899c89e0b8cbbd27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / asyncpg-0.5.3-cp35-cp35m-manylinux1_i686.whl
| Download URL | asyncpg-0.5.3-cp35-cp35m-manylinux1_i686.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-32 |
|
SHA-256 checksum How to use checksums |
548de8ae5cf933e3483979818de567e299f79268c1034b61e9bc5c5f4c4591b1
|
|
BLAKE2b-256 checksum How to use checksums |
2416297b221d597d3f5b7bd47233a84c7b4ff8e1f9e9634e779364a57873a7b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / asyncpg-0.5.3-cp35-cp35m-macosx_10_9_x86_64.whl
| Download URL | asyncpg-0.5.3-cp35-cp35m-macosx_10_9_x86_64.whl |
|---|---|
| Size | 607.2 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
e976641125bcea77a0fd8350db5ab1845176a8912444d666a3284f654e449006
|
|
BLAKE2b-256 checksum How to use checksums |
c8106f84619a723d30b7f061e6b08232e8f95dc9c97d6f11fcc46c4d91523332
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |