Search code examples
pythonpeewee

How to reselect record with peewee


I try to update all properties of Peewee model object from database.

It is like that :

row = OauthReplyThread.get(thread_id=1)
time.sleep(60)
row.updateFromDatabase()

Is there any method like row.updateFromDatabase() in peewee?


Solution

  • No but you can add one:

    def refresh(self):
        return type(self).get(self._pk_expr())