Peewee insert if doesn't exist

I am using Python / Mysql and Peewee as ORM. I am stuck in a situation. Suppose I want to insert a row using peewee, but check if this row exists by skipping else insert. Is there any procedure for this in python using peewee.

+4
source share
1 answer

Not sure what you've tried, but I suggest methods Model.get_or_create()or Model.create_or_get()from peewee to do what you are looking for: Peewee Get or Post

+4
source

All Articles