我有以下脚本:
from peewee import *
db = MySQLDatabase('database', user='root')
class BaseModel(Model):
class Meta:
database = db
class Locations(BaseModel):
location_id = PrimaryKeyField()
location_name = CharField()
class Units(BaseModel):
unit_id = PrimaryKeyField()
unit_num = IntegerField()
location_id = ForeignKeyField(Locations, related_name='units')
db.connect()
for location in Locations.select():
for pod_num in range (1, 9):
unit = Units.create(unit_num=pod_num, location_id=location.location_id)
Run Code Online (Sandbox Code Playgroud)
表位置有几行,表单位为空.当我尝试启动它时,我会一直异常:
(1054, "Unknown column 'location_id_id' in 'field list'")
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
以下是用于创建表的SQL脚本的一部分:
CREATE TABLE IF NOT EXISTS `database`.`units` (
`unit_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`unit_num` TINYINT UNSIGNED NOT NULL …Run Code Online (Sandbox Code Playgroud) 当我尝试使用命令行卸载它时,我使用WiX工具集创建了MSI包:
msiexec /x f987d323-303f-49a0-92e8-d1ab41589719
Run Code Online (Sandbox Code Playgroud)
msiexec向我显示错误:
"无法打开此安装包.请与应用程序供应商联系以验证这是否是有效的Windows Installer程序包."
但我可以毫无问题地从"添加或删除程序"中删除它.我已经仔细检查过msi md5校验和是否正确并将msi放在本地磁盘上,但似乎没有连接.
将不胜感激任何帮助.