Reputation: 874
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 that row exist skip else insert. Is there any procedure to do so in python using peewee.
Upvotes: 12
Views: 9114
Reputation: 2127
Not sure what you've tried already, but I'd suggest the Model.get_or_create()
or Model.create_or_get()
methods from peewee to do what you're looking for: Peewee Get or Create
Upvotes: 15