【问题标题】:EPFImporter creates table but imports nothingEPFImporter 创建表但不导入任何内容
【发布时间】:2012-03-15 02:31:23
【问题描述】:

我正在使用 Apple 的 EPFImporter 工具 http://www.apple.com/itunes/affiliates/resources/documentation/epfimporter.html

这是一个 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

该工具能够创建数据库。它只是不会将任何条目添加到数据库中。它显然看到了 200 万条以上的记录,并花时间梳理它们……删除和合并空白表……但就是这样 - 表仍然是空白的。我认为这可能是 mySQL 的权限问题。我仔细检查并确保所有内容都授予我正在使用的用户帐户。依然没有。

对这可能是什么有什么想法?

【问题讨论】:

  • 您解决了吗?我发现了同样的问题,但正如 maxperreault 所建议的那样,更改自动提交似乎对我不起作用。
  • 似乎对我有用的是删除用户/用户名/.python-eggs/ 中的任何内容stackoverflow.com/questions/3061277/… 我在想的是安装了不同的 mysql 位或其他东西。 .. 某些库处于错误的位模式。但在删除缓存在其中的内容后,它对我有用。
  • 感谢您回复我。不幸的是,这对我不起作用,但下一步可能是全新安装。

标签: python mysql


【解决方案1】:

你可以通过改变 EPFIgester.py 来让它工作:

  1. 查找函数

    def _populateTable(self, tableName, resumeNum=0,
    isIncremental=False, skipKeyViolators=False):
    
  2. 在函数中,在while循环中,找到行:

    cur = conn.cursor()
    
  3. 在它下面插入:

    cur.connection.autocommit(True)
    

更改后的源应如下所示:

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

【讨论】:

    【解决方案2】:

    EPFImporter 是在 2010 年制作的。当时,最新版本的 MySQLdb 将 autocommit 设置为 true。您使用的 MySQLdb 版本很可能是自动提交设置为 false 的较新版本。

    【讨论】:

    • 这正是我的问题。解决方案是您将全局自动提交标志设置为 true 如此处所述,否则请遵循@Chris Nilsson 的以下答案中给出的解决方案
    【解决方案3】:

    您使用的是什么存储引擎? 有完全相同的问题。将存储引擎从 InnoDB 切换到 MyISAM 解决了它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-16
      • 1970-01-01
      • 2014-05-30
      • 1970-01-01
      相关资源
      最近更新 更多