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.

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


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

Uploaded Source

Built Distributions

asyncpg-0.8.1-cp35-cp35m-win_amd64.whl (575.3 kB view details)

Uploaded CPython 3.5m Windows x86-64

asyncpg-0.8.1-cp35-cp35m-win32.whl (541.2 kB view details)

Uploaded CPython 3.5m Windows x86

asyncpg-0.8.1-cp35-cp35m-manylinux1_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.5m

asyncpg-0.8.1-cp35-cp35m-manylinux1_i686.whl (1.4 MB view details)

Uploaded CPython 3.5m

asyncpg-0.8.1-cp35-cp35m-macosx_10_11_x86_64.whl (830.3 kB view details)

Uploaded CPython 3.5m macOS 10.11+ x86-64

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

Hashes for asyncpg-0.8.1.tar.gz
Algorithm Hash digest
SHA256 dd9dc4c2c7c3265d5f2470834e90786ee902b874e72f791b328ccee980f16711
MD5 c6d54f55e3e90b53a80595d2876b5cf2
BLAKE2b-256 b4d04ac35dace3fc713bb41735e430e8b174d9aaa218cfd844bf807b6a06070f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.1-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 6e0615c208ea8fe69d9108603fa222bb8781d3be6133f3839f76f1b66acfc066
MD5 1a54d02b9964103eee4911dfeaf682c9
BLAKE2b-256 ecc4538ff36ab2ca70fc0aa343b89d04076a8aac4a6d328c5c960a7ab2cd13d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.1-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 6a61140390ba88d4e0079cd04d4688205b82809a74504e54cc72d5744f6c841a
MD5 c6c645fae507766667206e6c4af9b362
BLAKE2b-256 caaa0e5faf5b44cffee9af6e41af08205e70f9e1709b0a18d69e451b609be8d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 dc25effa509bd8e1881f1af9094c45377f4d7713c358a2832cf053a96072d253
MD5 c848d54653eb58e756d2b4fe10124142
BLAKE2b-256 680d5c290b1136cbe48153651441ec744e1035dfe91e888f455630d636d3df2f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.1-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 2c42abea6318d4e675c034f24729bd7a89c4ae1faf621b054dd968825a9989d7
MD5 ae059a762fe387df5ab223904acfdd04
BLAKE2b-256 4241091be68475a8f863f647d3ba84b48fbe3036e31571c884cbd621c2a247d6

See more details on using hashes here.

File details

Details for the file asyncpg-0.8.1-cp35-cp35m-macosx_10_11_x86_64.whl.

File metadata

File hashes

Hashes for asyncpg-0.8.1-cp35-cp35m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 dd043d7b29b96afd22cb093a8dd94e78a53b743766e40bf5add5564715d3a252
MD5 1938b76a3b562d28e0aa3a4f0e2335f6
BLAKE2b-256 7f59a3b78f728297160f95d0aabfa566cb9fc7d975e3c6a3dc2d662583ac9607

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