Debian Codegraph @

examples/example_oldstyle.py

raw
1 import asyncio
2 import aiomysql
3
4
5 loop = asyncio.get_event_loop()
6
7
8 @asyncio.coroutine
9 def test_example():
10 conn = yield from aiomysql.connect(
11 host='127.0.0.1',
12 port=3306,
13 user='root',
14 password='',
15 db='mysql',
16 loop=loop
17 )
18
19 cur = yield from conn.cursor()
20 yield from cur.execute("SELECT Host,User FROM user")
21 print(cur.description)
22 r = yield from cur.fetchall()
23 print(r)
24 yield from cur.close()
25 conn.close()
26
27
28 loop.run_until_complete(test_example())