wangyijieonline
2016-09-17 17:25
我这报错了
Wikipedia <---------> https://en.wikipedia.org/wiki/Wikipedia
Traceback (most recent call last):
File "E:\Demo\Python\Python35\urllib\wikipedia2mysql.py", line 37, in <module>
cursor.execute(sql,(url.get_text(),"https://en.wikipedia.org"+url["href"]))
File "D:\Python35\lib\site-packages\pymysql\cursors.py", line 166, in execute
result = self._query(query)
File "D:\Python35\lib\site-packages\pymysql\cursors.py", line 322, in _query
conn.query(q)
File "D:\Python35\lib\site-packages\pymysql\connections.py", line 835, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "D:\Python35\lib\site-packages\pymysql\connections.py", line 1019, in _read_query_result
result.read()
File "D:\Python35\lib\site-packages\pymysql\connections.py", line 1302, in read
first_packet = self.connection._read_packet()
File "D:\Python35\lib\site-packages\pymysql\connections.py", line 981, in _read_packet
packet.check_error()
File "D:\Python35\lib\site-packages\pymysql\connections.py", line 393, in check_error
err.raise_mysql_exception(self._data)
File "D:\Python35\lib\site-packages\pymysql\err.py", line 107, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.InternalError: (1364, "Field 'id' doesn't have a default value")
我的不可以,只能手动加上一个id字段,写入循环i=i+1,但写入时出现问题了,求教大家:
1如何使用自动递增字段的
2写入时是不是直接忽略这个字段
3自增字段必须设置成主键吗?
嘻嘻额 我的勾勒可以了
同问,勾选自动递增也没用
你要在新建urls表的时候勾选中下面的“自动递增”才可以
python遇见数据采集
59669 学习 · 200 问题
相似问题