Last active
May 4, 2017 05:06
-
-
Save Everfighting/3f9af00d78eaf5207814f0d83c071446 to your computer and use it in GitHub Desktop.
asyncpg:高效的基于 Python/asyncio 的 PostgreSQL 客户端库
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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