Python peewee save() doesn't work as expected
问题 I'm inserting/updating objects into a MySQL database using the peewee ORM for Python. I have a model like this: class Person(Model): person_id = CharField(primary_key=True) name = CharField() I create the objects/rows with a loop, and each time through the loop have a dictionary like: pd = {"name":"Alice","person_id":"A123456"} Then I try creating an object and saving it. po = Person() for key,value in pd.items(): setattr(po,key,value) po.save() This takes a while to execute, and runs without