Advertisement
Guest User

Untitled

a guest
Aug 30th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. import asyncio
  2. import aiopg
  3.  
  4. dsn = 'dbname=aiopg user=aiopg password=passwd host=127.0.0.1'
  5.  
  6. async def go():
  7. with aiopg.create_pool(dsn) as pool:
  8. with pool.acquire() as conn:
  9. with conn.cursor() as cur:
  10. await cur.execute("SELECT 1")
  11. ret = []
  12. for row in cur:
  13. ret.append(row)
  14. ret == [(1,)]
  15.  
  16. loop = asyncio.get_event_loop()
  17. loop.run_until_complete(go())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement