Asyncio psycopg2混合
psycaio的Python项目详细描述
心理
psycopg2的Python异步包装器
示例
importasynciofrompsycaioimportconnectasyncdeftest_conn():cn=awaitconnect(dbname='postgres')cr=cn.cursor()awaitcr.execute("SELECT 42")print(cr.fetchone()[0])cr=cn.cursor()awaitcr.execute("SELECT 42")print(cr.fetchone()[0])if__name__=='__main__':loop=asyncio.get_event_loop()loop.run_until_complete(test_conn())loop.close()
关于
这个包是作为psycopg2的一个最小的异步mixin。在
- 项目
标签: