Example #1
0
 def update(self, uuid, update_dict):
     model = self.model_class.get(uuid)
     if not model:
         raise ResourceNotFoundError('Not found')
     model = model.update(update_dict)
     model.persist()
     get_db_session().commit()
     return model
Example #2
0
 def save(self, model):
     database.get_db_session('write').add(model)
     database.get_db_session('write').commit()
     database.get_db_session('read').expunge_all()
Example #3
0
 def persist(self):
     get_db_session().add(self)
Example #4
0
 def query(cls):
     return get_db_session().query(cls)
Example #5
0
 def create_from_entity(self, entity):
     entity.validate()
     entity.persist()
     get_db_session().commit()
     return entity