Skip to content

Instantly share code, notes, and snippets.

@Everfighting
Last active May 4, 2017 05:06
Show Gist options
  • Save Everfighting/3f9af00d78eaf5207814f0d83c071446 to your computer and use it in GitHub Desktop.
Save Everfighting/3f9af00d78eaf5207814f0d83c071446 to your computer and use it in GitHub Desktop.
asyncpg:高效的基于 Python/asyncio 的 PostgreSQL 客户端库
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())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment