lundi 1 février 2016

Python+peewee: retrieve a field after Model.save() (and trigger execution in Sqlite database)

  1. In my application I work with Sqlite. In one of the tables inside database I've implemented a trigger (basically, after an insert event on the table TAB, it has to update a column named codecolumn which depends on the ID PK field)

  2. In my code I create and object from a PeeweeModel previously setted

    objfromModel = Model(params....)
    
    
  3. After the execution of line:

    objfromModel.save()
    
    

We hoped to get appart from the _id field generated -in fact objfromModel.id is retrieved from DB-, but also the codecolumn new field generated by the trigger execution on insert event. But objfromModel.codecolumn is None

Question: is there a trick to make on Peewee in order to recover this new field generated in database by trigger.

Aucun commentaire:

Enregistrer un commentaire