peewee

Python peewee save() doesn't work as expected

Python peewee save() doesn't work as expected Question: 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"} …

Total answers: 4

Peewee model to JSON

Peewee model to JSON Question: I’m creating an API using peewee as the ORM and I need the ability to convert a peewee model object into a JSON object to send to the user. Does anyone know of a good way to do this? Asked By: shoopdelang || Source Answers: Peewee has a model_to_dict and …

Total answers: 7

Peewee syntax for selecting on null field

Peewee syntax for selecting on null field Question: I have researched this everywhere and can’t seem to find an answer. I hope I haven’t duplicated this (as it’s my first question on SO). I am trying to write a select query with Peewee that would normally go … WHERE foo = NULL; in SQL world. …

Total answers: 1