예제 #1
0
 def delete(self, model):
     with Session() as session:
         session.delete(model)
         session.commit()
예제 #2
0
 def save(self, model):
     with Session() as session:
         session.add(model)
         session.commit()
         session.refresh(model)
     return model
예제 #3
0
 def read_by_id(self, id):
     with Session() as session:
         result = session.query(self.__model_type).filter_by(id_=id).first()
     return result
예제 #4
0
 def read_all(self):
     with Session() as session:
         result = session.query(self.__model_type).order_by('id').all()
     return result
예제 #5
0
 def save(self, model) -> None:
     with Session() as session:
         session.add(model)
         session.commit()
예제 #6
0
 def read_by_id(self, identifier: int):
     with Session() as session:
         result = session.query(self.__type_model).filter_by(id = identifier).first()
     return result
예제 #7
0
 def read_all(self) -> list:
     with Session() as session:
         result = session.query(self.__type_model).all()
     return result