我描述了一个小便模型:
class Products(peewee.Model):
article = peewee.CharField(primary_key=True)
name = peewee.CharField()
price = peewee.FloatField()
price_distributor = peewee.FloatField()
price_discount = peewee.FloatField()
class Meta:
database = get_db_connection()
然后尝试插入如下数据:
row = {
'article': row[0].value,
'name': row[1].value,
'price': row[2].value,
'price_distributor': row[3].value,
'price_discount': row[4].value
}
# Insert
Products.insert(row)
它没有给出任何错误,只是数据库是空的
答案 0 :(得分:0)
之后你需要调用.execute()。同样的更新&删除。