Why is peewee including the 'id' column into the mysql select query?

后端 未结 4 938
梦毁少年i
梦毁少年i 2021-02-05 17:07

I am trying to learn how to use peewee with mysql.

I have an existing database on a mysql server with an existing table. The table is currently empty (I am just testing

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-05 18:01

    You have to provide a primary_key field for this model. If your table doesn't have a single primary_key field(just like mine), a CompositeKey defined in Meta will help.

    primary_key = peewee.CompositeKey('date', 'team')
    

提交回复
热议问题