Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import asyncio
- import aiopg
- dsn = 'dbname=aiopg user=aiopg password=passwd host=127.0.0.1'
- async def go():
- with aiopg.create_pool(dsn) as pool:
- with pool.acquire() as conn:
- with conn.cursor() as cur:
- await cur.execute("SELECT 1")
- ret = []
- for row in cur:
- ret.append(row)
- ret == [(1,)]
- loop = asyncio.get_event_loop()
- loop.run_until_complete(go())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement