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

Uploaded Source

Built Distributions

asyncpg-0.8.2-cp36-cp36m-win_amd64.whl (582.8 kB view details)

Uploaded CPython 3.6m Windows x86-64

asyncpg-0.8.2-cp36-cp36m-win32.whl (547.2 kB view details)

Uploaded CPython 3.6m Windows x86

asyncpg-0.8.2-cp36-cp36m-manylinux1_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.6m

asyncpg-0.8.2-cp36-cp36m-manylinux1_i686.whl (1.4 MB view details)

Uploaded CPython 3.6m

asyncpg-0.8.2-cp36-cp36m-macosx_10_11_x86_64.whl (841.5 kB view details)

Uploaded CPython 3.6m macOS 10.11+ x86-64

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

Uploaded CPython 3.5m Windows x86-64

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

Uploaded CPython 3.5m Windows x86

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

Uploaded CPython 3.5m

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

Uploaded CPython 3.5m

asyncpg-0.8.2-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.2.tar.gz.

File metadata

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

File hashes

Hashes for asyncpg-0.8.2.tar.gz
Algorithm Hash digest
SHA256 6e3739068bd3125f466cb53bd2cb035d4a47330adf4696ad0cde53e11a4cb8e0
MD5 d29e55713a76031373b2d5f70e067514
BLAKE2b-256 5824fd0ffaa77530189e5653e411e41c56173419753924c178a4e232f0ed53a0

See more details on using hashes here.

File details

Details for the file asyncpg-0.8.2-cp36-cp36m-win_amd64.whl.

File metadata

File hashes

Hashes for asyncpg-0.8.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 09fb72a67a5702f28751279fb30d2c94ae904b8efba5cc7e1f54a9653d09df9c
MD5 c7689a8963ff455448f0228bf5cdef13
BLAKE2b-256 7823d54dc7e80a6c4363e0cbcd3cb69fce961063f7377c28cd07a1d9014d8aca

See more details on using hashes here.

File details

Details for the file asyncpg-0.8.2-cp36-cp36m-win32.whl.

File metadata

File hashes

Hashes for asyncpg-0.8.2-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 b9aa556e4117f6fb73db62f0d56c28e705ab16ba7a107fd502993af6a63bbeef
MD5 0bf782b9f85d39712792d34da7ab0c32
BLAKE2b-256 d9954c6606f4954656f0a1cfc50d1505db8c49f4ff2ac19eb594040c5915fa06

See more details on using hashes here.

File details

Details for the file asyncpg-0.8.2-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for asyncpg-0.8.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f5c15eee3cb5f10675d090e1dbfe34690042b02ddd308a652dc9d02f66afec3d
MD5 8de3155a79710ce4439fb11a4b3ad9c9
BLAKE2b-256 491931501273912033700e47e15bf1a2346c3659550b384bac69ed8fbd4ec6ce

See more details on using hashes here.

File details

Details for the file asyncpg-0.8.2-cp36-cp36m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for asyncpg-0.8.2-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 3793fcda2031e1f38bc086c62bf1986ccf91599779e8bf6440a8f98e12ec518d
MD5 d30d42251914a46258f650fb8949daa8
BLAKE2b-256 f881554dccaa3907e8f02535ac12c0568fbb8cdf98b010ba5712449baab28d8f

See more details on using hashes here.

File details

Details for the file asyncpg-0.8.2-cp36-cp36m-macosx_10_11_x86_64.whl.

File metadata

File hashes

Hashes for asyncpg-0.8.2-cp36-cp36m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 e78de478ddb12efcba21283d03bc914d7ca760953f1ac6bab56f6609391b2f75
MD5 1bee8ce27894d45b8f7fb1487bc6fc8f
BLAKE2b-256 19d284efcb051a0a600dee746050e7796a751704977e980b8cae2377a18c64eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.2-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 0d5dd2f091251e33dce25b140f79f709180d4453207a1ee3d355bf5c36cf62fe
MD5 89be152851c470842171965290e4bb67
BLAKE2b-256 15e13668cd50350411cf934435fa6e179101e4a90c1177211e536a63ba6b465b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.2-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 0087c89586ca98906597435e797351fcbf5f1731c77382ed8c21c8199a2dd3d6
MD5 0db9edfb2cd8cc52a086d63f587820e0
BLAKE2b-256 6f0a6c6761fc0514d86134de0f616a0f84e86ac4230aea5d771ce8fbc723989d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4d9015f8c9d6fc3aefe1b7947b0a93afafe3c5edd9f4a8c969216026d1de753c
MD5 5b411f370647c2f9939c8ac82c6419cd
BLAKE2b-256 1861ac7dcfcaa8b870b2f8e53b125f95484b3539bddd3b676945148341130ff5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.2-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 1cd446159c611163d1c5de28aadc059f2db500a1d71d64d95de584326f75ef77
MD5 61aa3874a40403c7cb45c160d125b6f4
BLAKE2b-256 9a58ad75001f95b21f9de3068a636f998f8e081efb48b62cd9afcf2f91f52f9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncpg-0.8.2-cp35-cp35m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 03ab7958a5314b7e6b19a72d83d80985ed7d01a4f6d2b54c77cdf0d3db27b5aa
MD5 fd5c22c061164c9f9b17589a7ff0ab38
BLAKE2b-256 371f0d0b0bf3b6336ca83fcfc0cbcb7169699165c6798b3ec8a252ec36cb8d2c

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