An asyncio PosgtreSQL driver
Project description
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.
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).
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file asyncpg-0.8.1.tar.gz
.
File metadata
- Download URL: asyncpg-0.8.1.tar.gz
- Upload date:
- Size: 375.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd9dc4c2c7c3265d5f2470834e90786ee902b874e72f791b328ccee980f16711 |
|
MD5 | c6d54f55e3e90b53a80595d2876b5cf2 |
|
BLAKE2b-256 | b4d04ac35dace3fc713bb41735e430e8b174d9aaa218cfd844bf807b6a06070f |
File details
Details for the file asyncpg-0.8.1-cp35-cp35m-win_amd64.whl
.
File metadata
- Download URL: asyncpg-0.8.1-cp35-cp35m-win_amd64.whl
- Upload date:
- Size: 575.3 kB
- Tags: CPython 3.5m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e0615c208ea8fe69d9108603fa222bb8781d3be6133f3839f76f1b66acfc066 |
|
MD5 | 1a54d02b9964103eee4911dfeaf682c9 |
|
BLAKE2b-256 | ecc4538ff36ab2ca70fc0aa343b89d04076a8aac4a6d328c5c960a7ab2cd13d9 |
File details
Details for the file asyncpg-0.8.1-cp35-cp35m-win32.whl
.
File metadata
- Download URL: asyncpg-0.8.1-cp35-cp35m-win32.whl
- Upload date:
- Size: 541.2 kB
- Tags: CPython 3.5m, Windows x86
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a61140390ba88d4e0079cd04d4688205b82809a74504e54cc72d5744f6c841a |
|
MD5 | c6c645fae507766667206e6c4af9b362 |
|
BLAKE2b-256 | caaa0e5faf5b44cffee9af6e41af08205e70f9e1709b0a18d69e451b609be8d8 |
File details
Details for the file asyncpg-0.8.1-cp35-cp35m-manylinux1_x86_64.whl
.
File metadata
- Download URL: asyncpg-0.8.1-cp35-cp35m-manylinux1_x86_64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc25effa509bd8e1881f1af9094c45377f4d7713c358a2832cf053a96072d253 |
|
MD5 | c848d54653eb58e756d2b4fe10124142 |
|
BLAKE2b-256 | 680d5c290b1136cbe48153651441ec744e1035dfe91e888f455630d636d3df2f |
File details
Details for the file asyncpg-0.8.1-cp35-cp35m-manylinux1_i686.whl
.
File metadata
- Download URL: asyncpg-0.8.1-cp35-cp35m-manylinux1_i686.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c42abea6318d4e675c034f24729bd7a89c4ae1faf621b054dd968825a9989d7 |
|
MD5 | ae059a762fe387df5ab223904acfdd04 |
|
BLAKE2b-256 | 4241091be68475a8f863f647d3ba84b48fbe3036e31571c884cbd621c2a247d6 |
File details
Details for the file asyncpg-0.8.1-cp35-cp35m-macosx_10_11_x86_64.whl
.
File metadata
- Download URL: asyncpg-0.8.1-cp35-cp35m-macosx_10_11_x86_64.whl
- Upload date:
- Size: 830.3 kB
- Tags: CPython 3.5m, macOS 10.11+ x86-64
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd043d7b29b96afd22cb093a8dd94e78a53b743766e40bf5add5564715d3a252 |
|
MD5 | 1938b76a3b562d28e0aa3a4f0e2335f6 |
|
BLAKE2b-256 | 7f59a3b78f728297160f95d0aabfa566cb9fc7d975e3c6a3dc2d662583ac9607 |