Python Peewee ORM将IntegerField设置为none

Python Peewee ORM将IntegerField设置为none,python,peewee,flask-peewee,Python,Peewee,Flask Peewee,两台服务器,结果不同。相同版本的peewee,相同版本的mysql,相同的python 2.7.10 代码: 我的mac电脑上的输出: 我的服务器上的输出 没有 WTF 另一个线索。如果我将其更改为: class ItemAttribute(Model): id = IntegerField() value = IntegerField() item_id = IntegerField() attribute_idx = IntegerField() at

两台服务器,结果不同。相同版本的peewee,相同版本的mysql,相同的python 2.7.10

代码:

我的mac电脑上的输出:

我的服务器上的输出

没有

WTF

另一个线索。如果我将其更改为:

class ItemAttribute(Model):
    id = IntegerField()
    value = IntegerField()
    item_id = IntegerField()
    attribute_idx = IntegerField()
    attribute_id = IntegerField()
    item = ForeignKeyField(Item)
    attribute = ForeignKeyField(Attribute)

    class Meta:
        database = mysql_db
        db_table = 'item_attribute'
这是:

pprint.pprint(ItemAttribute.item_id)
pprint.pprint(ItemAttribute.attribute_idx)
pprint.pprint(ItemAttribute.attribute_id)
它打印出这个:


您有相互冲突的冗余字段声明

例如,如果您有:

attribute=ForeignKeyFieldAttribute 属性\u id=整数字段


这些是多余的-你只需要一个或另一个。如果要强制外键约束,请保留ForeignKeyField。如果你只想得到一个整数,那么就使用IntegerField。

我认为这不是真的。如果我删除integerfield并保留外键,那么我会得到itemtribute没有属性item\u id要澄清的是,如果没有foreignkeyfield和integerfield,我如何使这个查询工作?属性标识列表=[31,32,33,34,35,36,37,38,39,40]项目标识列表=[31,32,33,34,35,36,37,38,39,40,41,42,43,44]query=itemtribute.selectitemtribute.whereitemtribute.item\u id您从何处获得需要为整型存储和外键同时使用字段对象的想法?事实上,如果不是这样,它就不起作用。你能告诉我如果没有这两者,它会如何工作吗?
pprint.pprint(ItemAttribute.item_id)
pprint.pprint(ItemAttribute.attribute_idx)
pprint.pprint(ItemAttribute.attribute_id)