This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

aiopg is a library for accessing a PostgreSQL database from the asyncio (PEP-3156/tulip) framework. It wraps asynchronous features of the Psycopg database driver.


import asyncio
from aiopg.pool import create_pool

dsn = 'dbname=jetty user=nick password=1234 host=localhost port=5432'

def test_select():
    pool = yield from create_pool(dsn)

    with (yield from pool) as conn:
        cur = yield from conn.cursor()
        yield from cur.execute('SELECT 1')
        ret = yield from cur.fetchone()
        assert ret == (1,), ret


Example of SQLAlchemy optional integration

import asyncio
from import create_engine
import sqlalchemy as sa

metadata = sa.MetaData()

tbl = sa.Table('tbl', metadata,
    sa.Column('id', sa.Integer, primary_key=True),
    sa.Column('val', sa.String(255)))

def go():
    engine = yield from create_engine(user='aiopg',

    with (yield from engine) as conn:
        yield from conn.execute(tbl.insert().values(val='abc'))

        res = yield from conn.execute(
        for row in res:
            print(, row.val)


Please use:

$ python3

for executing project’s unittests


0.8.0 (XXXX-XX-XX)

  • Add PostgreSQL notification support #58
  • Support pools with unlimited size #59

0.7.0 (2015-04-22)

  • Get rid of resource leak on connection failure.
  • Report ResourceWarning on non-closed connections.
  • Deprecate iteration protocol support in cursor and ResultProxy.
  • Release sa connection to pool on connection.close().

0.6.0 (2015-02-03)

  • Accept dict, list, tuple, named and positional parameters in SAConnection.execute()

0.5.2 (2014-12-08)

  • Minor release, fixes a bug that leaves connection in broken state after cursor.execute() failure.

0.5.1 (2014-10-31)

  • Fix a bug for processing transactions in line.

0.5.0 (2014-10-31)

  • Add .terminate() to Pool and Engine
  • Reimplement connection pool (now pool size cannot be greater than pool.maxsize)
  • Add .close() and .wait_closed() to Pool and Engine
  • Add minsize, maxsize, size and freesize properties to sa.Engine
  • Support echo parameter for logging executed SQL commands
  • Connection.close() is not a coroutine (but we keep backward compatibility).

0.4.1 (2014-10-02)

  • make cursor iterable
  • update docs

0.4.0 (2014-10-02)

  • add timeouts for database operations.
  • Autoregister psycopg2 support for json data type.
  • Support JSON in
  • Support ARRAY in
  • Autoregister hstore support if present in connected DB
  • Support HSTORE in

0.3.2 (2014-07-07)

  • change signature to cursor.execute(operation, parameters=None) to follow psycopg2 convention.

0.3.1 (2014-07-04)

  • Forward arguments to cursor constructor for pooled connections.

0.3.0 (2014-06-22)

  • Allow executing SQLAlchemy DDL statements.
  • Fix bug with race conditions on acquiring/releasing connections from pool.

0.2.3 (2014-06-12)

  • Fix bug in connection pool.

0.2.2 (2014-06-07)

  • Fix bug with passing parameters into SAConnection.execute when executing raw SQL expression.

0.2.1 (2014-05-08)

  • Close connection with invalid transaction status on returning to pool.

0.2.0 (2014-05-04)

  • Implemented optional support for sqlalchemy functional sql layer.

0.1.0 (2014-04-06)

  • Implemented plain connections: connect, Connection, Cursor.
  • Implemented database pools: create_pool and Pool.
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
aiopgx-0.7.0.tar.gz (21.6 kB) Copy SHA256 Checksum SHA256 Source Jul 24, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting