0
我在嘗試使用imdbpy2sql.py腳本將imdb數據從文本文件導入到MySQL數據庫時遇到問題。IMDbPY導入到MySQL問題
它會引發以下錯誤。看起來異常處理程序代碼嘗試使用現有主鍵將重複記錄插入到cast_info表中。
任何人都可以幫助我解決這個問題或建議任何解決方案?
SCANNING actor: Hall, Stephan
SCANNING actor: Halsey, William F.
* FLUSHING CharactersCache...
* TOO MANY DATA (100000 items in CharactersCache), recursion: 1
* SPLITTING (run 1 of 2), recursion: 1
* FLUSHING CharactersCache...
Traceback (most recent call last):
File "D:\project\IMDB\IMDbPY-4.7\bin\imdbpy2sql.py", line 2951, in <module>
run()
File "D:\project\IMDB\IMDbPY-4.7\bin\imdbpy2sql.py", line 2812, in run
castLists(_charIDsList=characters_imdbIDs)
File "D:\project\IMDB\IMDbPY-4.7\bin\imdbpy2sql.py", line 1576, in castLists
doCast(f, roleid, rolename)
File "D:\project\IMDB\IMDbPY-4.7\bin\imdbpy2sql.py", line 1535, in doCast
cid = CACHE_CID.addUnique(role)
File "D:\project\IMDB\IMDbPY-4.7\bin\imdbpy2sql.py", line 957, in addUnique
else: return self.add(key, miscData)
File "D:\project\IMDB\IMDbPY-4.7\bin\imdbpy2sql.py", line 950, in add
self[key] = c
File "D:\project\IMDB\IMDbPY-4.7\bin\imdbpy2sql.py", line 860, in __setitem__
self.flush()
File "D:\project\IMDB\IMDbPY-4.7\bin\imdbpy2sql.py", line 912, in flush
self.flush(quiet=quiet, _recursionLevel=_recursionLevel)
File "D:\project\IMDB\IMDbPY-4.7\bin\imdbpy2sql.py", line 883, in flush
self._toDB(quiet)
File "D:\project\IMDB\IMDbPY-4.7\bin\imdbpy2sql.py", line 1186, in _toDB
CURS.executemany(self.sqlstr, self.converter(l))
File "C:\Python27\lib\site-packages\MySQLdb\cursors.py", line 206, in executemany
r = r + self.execute(query, a)
File "C:\Python27\lib\site-packages\MySQLdb\cursors.py", line 174, in execute
self.errorhandler(self, exc, value)
File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.IntegrityError: (1062, "Duplicate entry '745684' for key 'PRIMARY'")
如果你正在使用MySQL作爲後端,請確保您使用--mysql力,MyISAM和你的mysql引擎設置爲MyISAM的,我浪費了很多時間在innodb下試用(真的很慢你) – viper