예제 #1
0
 def getAllWhere(cls, db, **kwargs):
     with db.get_session() as session:
         return (
             session
                 .query(cls)
                 .filter_by(**kwargs)
                 .order_by(cls.updated).all()
         )
예제 #2
0
 def getAllWhere(cls, db, **kwargs):
     with db.get_session() as session:
         return (
             session
                 .query(cls)
                 .filter_by(**kwargs)
                 .order_by(cls.updated).all()
         )
예제 #3
0
 def getRecent(cls, db, recent=24):
     recent_date = time_services.now() - datetime.timedelta(hours=recent)
     with db.get_session() as session:
         return (
             session
                 .query(cls)
                 .filter(cls.updated > recent_date)
                 .order_by(cls.updated).all()
         )
예제 #4
0
 def getRecent(cls, db, recent=24):
     recent_date = time_services.now() - datetime.timedelta(hours=recent)
     with db.get_session() as session:
         return (
             session
                 .query(cls)
                 .filter(cls.updated > recent_date)
                 .order_by(cls.updated).all()
         )
예제 #5
0
 def deleteWhere(cls, db, **kwargs):
     with db.get_session() as session:
         deleteJobs = cls.getAllWhere(db, **kwargs)
         for job in deleteJobs:
             session.delete(job)
예제 #6
0
 def delete(self, db):
     with db.get_session() as session:
         obj, = session.query(self.__class__).filter_by(
             project_name=self.project_name, change_num=self.change_num).all()
         session.delete(obj)
예제 #7
0
 def update_database_record(self, db, **kwargs):
     with db.get_session() as session:
         for name, value in kwargs.iteritems():
             setattr(self, name, value)
예제 #8
0
 def deleteWhere(cls, db, **kwargs):
     with db.get_session() as session:
         deleteJobs = cls.getAllWhere(db, **kwargs)
         for job in deleteJobs:
             session.delete(job)
예제 #9
0
 def delete(self, db):
     with db.get_session() as session:
         obj, = session.query(self.__class__).filter_by(
             project_name=self.project_name, change_num=self.change_num).all()
         session.delete(obj)
예제 #10
0
 def update_database_record(self, db, **kwargs):
     with db.get_session() as session:
         for name, value in kwargs.iteritems():
             setattr(self, name, value)