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.
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.
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.5.2.tar.gz
.
File metadata
- Download URL: asyncpg-0.5.2.tar.gz
- Upload date:
- Size: 331.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d844206037eacc44989b5ecfb07da1c840624f272ebcf12b3d572dc1edb5074b |
|
MD5 | b7b3773333cd1409e783d84a92386f92 |
|
BLAKE2b-256 | 9720d4ad4bb587200a10041d74a84c1eb4e424bd70a297e9a7ce898d56494752 |
File details
Details for the file asyncpg-0.5.2-cp35-cp35m-manylinux1_x86_64.whl
.
File metadata
- Download URL: asyncpg-0.5.2-cp35-cp35m-manylinux1_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c48aa29da7456c36a39900e39aefe98da85cf664f0b5925194f1aff6e690d7ae |
|
MD5 | 41f53a34970defed6e074e73e9e490b6 |
|
BLAKE2b-256 | 7f28cce394af659007cadb8a901affcdabf36f290777da28fca3231e3a9765a5 |
File details
Details for the file asyncpg-0.5.2-cp35-cp35m-manylinux1_i686.whl
.
File metadata
- Download URL: asyncpg-0.5.2-cp35-cp35m-manylinux1_i686.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aae8c45c50e73233934a056a657619476b4b75bb55bedbd4133b857a647d9ea9 |
|
MD5 | 01950dcbb000a0297da6ce376797a647 |
|
BLAKE2b-256 | d0a9d2be95e6afb25ba036ad7ec89392e772823dbc91b4ba6fc4308ee869afed |
File details
Details for the file asyncpg-0.5.2-cp35-cp35m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: asyncpg-0.5.2-cp35-cp35m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 607.1 kB
- Tags: CPython 3.5m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a46c15545fdbfeb2636a7335956e2d19ff375111b306b630a1855246944d6fd9 |
|
MD5 | c853d0116aaf4091ec64b857b20ea520 |
|
BLAKE2b-256 | 520c6236b9d85e020933017b79f91ce9232c96809253fafc5b48f0eed2e02d59 |