Skip to main content

An asyncio PosgtreSQL driver

Project description

https://travis-ci.org/MagicStack/asyncpg.svg?branch=master 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.

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

https://github.com/MagicStack/asyncpg/raw/master/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.5.3.tar.gz (344.1 kB view details)

Uploaded Source

Built Distributions

asyncpg-0.5.3-cp35-cp35m-manylinux1_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.5m

asyncpg-0.5.3-cp35-cp35m-manylinux1_i686.whl (1.2 MB view details)

Uploaded CPython 3.5m

asyncpg-0.5.3-cp35-cp35m-macosx_10_9_x86_64.whl (607.2 kB view details)

Uploaded CPython 3.5m macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: asyncpg-0.5.3.tar.gz
  • Upload date:
  • Size: 344.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for asyncpg-0.5.3.tar.gz
Algorithm Hash digest
SHA256 b874758ca2369655917214f5177a0b512ad909dbd908d49ca6e791d6fc82a136
MD5 797e578d6cdfc3a3af9b3d2b870e829b
BLAKE2b-256 d902f14375a6f16d9cbe54dce8f36e632cce18c50f8337fefe1f47650c51ec35

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.5.3-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7304bf463c02e8d61f0142835dc45dbd38ecf65a272cfb985e69fed47fb1e371
MD5 6d0818e6455d3ef35f0c2aff8e51ee68
BLAKE2b-256 168454fca594375bc11814653f3dad214d896f8af5e1071b899c89e0b8cbbd27

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.5.3-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 548de8ae5cf933e3483979818de567e299f79268c1034b61e9bc5c5f4c4591b1
MD5 d7c92ab04cfcc37388bba3061d53bbd8
BLAKE2b-256 2416297b221d597d3f5b7bd47233a84c7b4ff8e1f9e9634e779364a57873a7b6

See more details on using hashes here.

File details

Details for the file asyncpg-0.5.3-cp35-cp35m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for asyncpg-0.5.3-cp35-cp35m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e976641125bcea77a0fd8350db5ab1845176a8912444d666a3284f654e449006
MD5 935fb4e0c99f136820096ffc29d95777
BLAKE2b-256 c8106f84619a723d30b7f061e6b08232e8f95dc9c97d6f11fcc46c4d91523332

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