在我的 mysql 上"RuntimeError: could not retrieve last insert ID"



我正在尝试从此来源安装Prelude软件包和Prewikka软件包。我遵循此手册使用者的所有说明。

我已经在Ubuntu上构建了所有源没有错误,但是当我尝试连接到localhost:8000时,我会从服务器端获得错误:

$ prewikka-httpd
Traceback (most recent call last):
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/local/bin/prewikka-httpd", line 62, in application
    return wsgi.application(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/web/wsgi.py", line 161, in application
    core.process(WSGIRequest(environ, start_response))
  File "/usr/local/lib/python2.7/dist-packages/prewikka/main.py", line 280, in process
    response = err.respond()
  File "/usr/local/lib/python2.7/dist-packages/prewikka/error.py", line 106, in respond
    return self._html_respond()
  File "/usr/local/lib/python2.7/dist-packages/prewikka/error.py", line 90, in _html_respond
    from prewikka import baseview
  File "/usr/local/lib/python2.7/dist-packages/prewikka/baseview.py", line 27, in <module>
    from prewikka import error, history, hookmanager, resource, response, template, utils, view
  File "/usr/local/lib/python2.7/dist-packages/prewikka/history.py", line 102, in <module>
    crontab.schedule("search_history", N_("Search history deletion"), "0 * * * *", _regfunc=history._history_cron, enabled=True)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/crontab.py", line 240, in schedule
    self._init_system_job(ext_type, name, schedule, enabled, _regfunc)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/database.py", line 91, in inner
    ret = func(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/crontab.py", line 152, in _init_system_job
    res = env.db.query("SELECT 1 FROM Prewikka_Crontab WHERE ext_type=%s AND userid IS NULL", ext_type)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/database.py", line 547, in query
    return preludedb.SQL.query(self, sql)
RuntimeError: Table 'prewikka.Prewikka_Crontab' doesn't exist

所以我尝试手动制作表数据库:

mysql> desc Prewikka_Crontab;
+----------+-----------+------+-----+---------+-------+
| Field    | Type      | Null | Key | Default | Extra |
+----------+-----------+------+-----+---------+-------+
| id       | int(11)   | YES  | UNI | NULL    |       |
| name     | char(255) | NO   | PRI | NONE    |       |
| userid   | int(11)   | YES  | UNI | NULL    |       |
| schedule | char(255) | NO   | UNI | NONE    |       |
| ext_type | char(255) | NO   | UNI | NONE    |       |
| ext_id   | int(11)   | YES  | UNI | NULL    |       |
| base     | char(255) | NO   | UNI | NONE    |       |
| runcnt   | char(255) | NO   | UNI | NONE    |       |
| enabled  | char(255) | NO   | UNI | NONE    |       |
| error    | char(255) | NO   | UNI | NONE    |       |
+----------+-----------+------+-----+---------+-------+
10 rows in set (0.09 sec)
mysql>

,然后我尝试再次连接到localhost:8000,我得到错误:

$ prewikka-httpd
Traceback (most recent call last):
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/local/bin/prewikka-httpd", line 62, in application
    return wsgi.application(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/web/wsgi.py", line 161, in application
    core.process(WSGIRequest(environ, start_response))
  File "/usr/local/lib/python2.7/dist-packages/prewikka/main.py", line 280, in process
    response = err.respond()
  File "/usr/local/lib/python2.7/dist-packages/prewikka/error.py", line 106, in respond
    return self._html_respond()
  File "/usr/local/lib/python2.7/dist-packages/prewikka/error.py", line 90, in _html_respond
    from prewikka import baseview
  File "/usr/local/lib/python2.7/dist-packages/prewikka/baseview.py", line 27, in <module>
    from prewikka import error, history, hookmanager, resource, response, template, utils, view
  File "/usr/local/lib/python2.7/dist-packages/prewikka/history.py", line 102, in <module>
    crontab.schedule("search_history", N_("Search history deletion"), "0 * * * *", _regfunc=history._history_cron, enabled=True)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/crontab.py", line 240, in schedule
    self._init_system_job(ext_type, name, schedule, enabled, _regfunc)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/database.py", line 91, in inner
    ret = func(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/crontab.py", line 154, in _init_system_job
    self.add(name, schedule, ext_type=ext_type, enabled=enabled)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/crontab.py", line 219, in add
    return self.update(None, name=name, schedule=schedule, user=user, ext_type=ext_type, ext_id=ext_id, enabled=enabled)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/crontab.py", line 209, in update
    return env.db.getLastInsertIdent()
RuntimeError: could not retrieve last insert ID

我仍然不了解数据库上的错误RuntimeError: could not retrieve last insert ID

编辑#1

我尝试了@vineesh建议,我的表数据库为:

mysql> DESC Prewikka_Crontab;
+----------+-----------+------+-----+---------+----------------+
| Field    | Type      | Null | Key | Default | Extra          |
+----------+-----------+------+-----+---------+----------------+
| id       | int(11)   | NO   | PRI | NULL    | auto_increment |
| name     | char(255) | NO   | UNI | NONE    |                |
| userid   | int(11)   | YES  | UNI | NULL    |                |
| schedule | char(255) | NO   | UNI | NONE    |                |
| ext_type | char(255) | NO   | UNI | NONE    |                |
| ext_id   | int(11)   | YES  | UNI | NULL    |                |
| base     | char(255) | NO   | UNI | NONE    |                |
| runcnt   | char(255) | NO   | UNI | NONE    |                |
| enabled  | char(255) | NO   | UNI | NONE    |                |
| error    | char(255) | NO   | UNI | NONE    |                |
+----------+-----------+------+-----+---------+----------------+
10 rows in set (0.03 sec)

,当我连接服务器时,我会收到错误:

$ prewikka-httpd
Traceback (most recent call last):
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/local/bin/prewikka-httpd", line 62, in application
    return wsgi.application(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/web/wsgi.py", line 161, in application
    core.process(WSGIRequest(environ, start_response))
  File "/usr/local/lib/python2.7/dist-packages/prewikka/main.py", line 280, in process
    response = err.respond()
  File "/usr/local/lib/python2.7/dist-packages/prewikka/error.py", line 106, in respond
    return self._html_respond()
  File "/usr/local/lib/python2.7/dist-packages/prewikka/error.py", line 91, in _html_respond
    return baseview.BaseView().respond(self._setup_template(self.template, False), self.code)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/view.py", line 481, in __init__
    registrar.DelayedRegistrar.__init__(self)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/registrar.py", line 46, in __init__
    i(ref)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/view.py", line 583, in _add_route
    self._views_rules[rule] = v
TypeError: unhashable type: 'Rule'

我该怎么办?希望任何人都可以帮助我!

预先感谢。

iD字段" prewikka_crontab"应该是自动增量列。

出现输出错误,导致我的索引表上的表格确实很差。我需要删除它并再次重新创建它。

python脚本上可用的格式表

所需的表:

mysql> DESC Prewikka_Crontab;
+----------+---------------------+------+-----+---------+----------------+
| Field    | Type                | Null | Key | Default | Extra          |
+----------+---------------------+------+-----+---------+----------------+
| id       | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| name     | varchar(255)        | NO   |     | NULL    |                |
| userid   | varchar(32)         | YES  |     | NULL    |                |
| schedule | varchar(32)         | YES  |     | NULL    |                |
| ext_type | varchar(255)        | YES  |     | NULL    |                |
| ext_id   | int(11)             | YES  |     | NULL    |                |
| base     | datetime            | NO   |     | NULL    |                |
| enabled  | tinyint(4)          | YES  |     | 1       |                |
| runcnt   | int(11)             | YES  |     | 0       |                |
| error    | text                | YES  |     | NULL    |                |
+----------+---------------------+------+-----+---------+----------------+
10 rows in set (0.01 sec)

希望这会有所帮助。

相关内容

最新更新