Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python EPFImporter创建表,但不导入任何内容_Python_Mysql - Fatal编程技术网

Python EPFImporter创建表,但不导入任何内容

Python EPFImporter创建表,但不导入任何内容,python,mysql,Python,Mysql,我正在使用苹果的EPFImporter工具 这是一个Python脚本,它将占用空间分隔的EPF文件列表并将它们导入到我的数据库中 以下是我所拥有的: Braden-Keiths-MacBook-Pro:~ bradenkeith$ ./EPFImporter.py /Users/bradenkeith/Downloads/popularity20120314 以下是CLI返回的内容: 2012-03-14 22:12:28,748 [INFO]: Beginning import for t

我正在使用苹果的EPFImporter工具

这是一个Python脚本,它将占用空间分隔的EPF文件列表并将它们导入到我的数据库中

以下是我所拥有的:

Braden-Keiths-MacBook-Pro:~ bradenkeith$ ./EPFImporter.py /Users/bradenkeith/Downloads/popularity20120314 
以下是CLI返回的内容:

2012-03-14 22:12:28,748 [INFO]: Beginning import for the following directories:
    /Users/bradenkeith/Downloads/popularity20120314 
2012-03-14 22:12:28,748 [INFO]: Importing files in /Users/bradenkeith/Downloads/popularity20120314 
2012-03-14 22:12:28,749 [INFO]: Starting import of /Users/bradenkeith/Downloads/popularity20120314... 
2012-03-14 22:12:28,749 [INFO]: Beginning full ingest of epf_application_popularity_per_genre (2000491 records) 
2012-03-14 22:14:28,774 [INFO]: ...at record 1797000... 
2012-03-14 22:16:02,152 [INFO]: Full ingest of epf_application_popularity_per_genre took 0:03:33.402408 
2012-03-14 22:16:02,196 [INFO]: Import of popularity20120314 completed at: 12-03-14 22:16:02 
2012-03-14 22:16:02,196 [INFO]: Total import time for popularity20120314: 0:03:33.44 
2012-03-14 22:16:02,196 [INFO]: Total import time for all directories: 0:03:33.44
该工具能够创建数据库。它只是不会将任何条目添加到数据库中。它显然看到了2mil+的记录,并花时间梳理它们。。。删除和合并空白表…但只是,表格还是空白的。我想这可能是mySQL的权限问题。我仔细检查并确保所有内容都已授予我正在使用的用户帐户。还是没什么


你知道这可能是什么吗?

EPFImporter是在2010年制造的。当时,MySQLdb的最新版本将autocommit设置为true。您正在使用的MySQLdb版本很可能是较新版本,其中autocommit设置为false

您可以根据以下内容修改EPFIngester.py,使其正常工作:

  • 查找函数

    def _populateTable(self, tableName, resumeNum=0,
    isIncremental=False, skipKeyViolators=False):
    
  • 在函数中的while循环中,查找行:

    cur = conn.cursor()
    
  • 在其下插入:

    cur.connection.autocommit(True)
    
  • 更改后的源应如下所示:

    ...
    cur = conn.cursor()
    cur.connection.autocommit(True)
    colVals = unicode(", ".join(stringList), 'utf-8')
    ....
    

    您使用的是什么存储引擎?
    我也有同样的问题。将存储引擎从InnoDB切换到MyISAM解决了这个问题。

    您解决了这个问题吗?我发现了同样的问题,但正如maxperreault所建议的那样,更改自动提交似乎对我不起作用。对我来说似乎起作用的是删除Users/username/.python-egs/per中的任何内容。我认为安装了不同的mysql或其他内容。。。某些库处于错误的位模式。但在删除了缓存的内容后,它对我起了作用。谢谢你回复我。不幸的是,这对我不起作用,但下一步可能是重新安装。这正是我的问题所在。解决方案是,如本文所述,将全局自动提交标志设置为true,或者按照下面由@Chris Nilsson给出的答案执行