aio-libs/aiopg — pull request #33 by kingxsp (2014-09-28 08:58:59+00:00)
Title:  Pool loop

my project use:

import asyncio
import aiopg
from psycopg2.extras import RealDictCursor

dsn = 'dbname=tests user=test password=123456 host=127.0.0.1 port=5432'
pool = aiopg.Pool(dsn, minsize=10, maxsize=1000, cursor_factory=RealDictCursor)

@asyncio.coroutine
def test_select():
with (yield from pool.cursor()) as cur:
yield from cur.execute("SELECT tt FROM test WHERE id = %s ", (1, ))
ret = yield from cur.fetchone()
print(ret)