Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

day4 最后test的时候出现awesome.user doesnt exist的报错 #51

Open
soringswath opened this issue Mar 1, 2019 · 3 comments
Open

Comments

@soringswath
Copy link

Traceback (most recent call last):
File "/Users/liulizhong/awesome-python3-webapp/www/test.py", line 15, in
loop.run_until_complete(insert(loop))
File "/anaconda3/lib/python3.6/asyncio/base_events.py", line 473, in run_until_complete
return future.result()
File "/Users/liulizhong/awesome-python3-webapp/www/test.py", line 11, in insert
await u.save()
File "/Users/liulizhong/awesome-python3-webapp/www/orm.py", line 233, in save
rows = await execute(self.insert,args)
File "/Users/liulizhong/awesome-python3-webapp/www/orm.py", line 48, in execute
await cur.execute(sql.replace('?', '%s'), args)
File "/anaconda3/lib/python3.6/site-packages/aiomysql/cursors.py", line 237, in execute
await self._query(query)
File "/anaconda3/lib/python3.6/site-packages/aiomysql/cursors.py", line 455, in _query
await conn.query(q)
File "/anaconda3/lib/python3.6/site-packages/aiomysql/connection.py", line 420, in query
await self._read_query_result(unbuffered=unbuffered)
File "/anaconda3/lib/python3.6/site-packages/aiomysql/connection.py", line 607, in _read_query_result
await result.read()
File "/anaconda3/lib/python3.6/site-packages/aiomysql/connection.py", line 1089, in read
first_packet = await self.connection._read_packet()
File "/anaconda3/lib/python3.6/site-packages/aiomysql/connection.py", line 578, in _read_packet
packet.check_error()
File "/anaconda3/lib/python3.6/site-packages/pymysql/protocol.py", line 220, in check_error
err.raise_mysql_exception(self._data)
File "/anaconda3/lib/python3.6/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.ProgrammingError: (1146, "Table 'awesome.user' doesn't exist")

源码是
import orm , asyncio
from models import User, Blog, Comment

async def insert(loop):
await orm.create_pool(loop = loop, user='liusanshui', password='12345', db='awesome')

u = User(name='Test', email='1233445@qq.com', passwd='1234567890', image='about:blank')

await u.save()

loop = asyncio.get_event_loop()
loop.run_until_complete(insert(loop))
loop.run_forever()

for x in insert(loop):
pass

有没有大牛能帮忙看一下

@xingdongzhe
Copy link

你在数据里面建表了吗?在mysql 里面建立awesome数据库,在该数据库中建user表

@wolflb
Copy link

wolflb commented May 27, 2019 via email

@lindonge
Copy link

lindonge commented May 27, 2019 via email

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants