def get_by_region_and_year(self, region_id, year, page_sort_params=None): query = self.db.session.query(self.model) query = QueryHelper.build_page_sort_query(query, self.model, page_sort_params) return query \ .filter(self.model.fk_region_id == region_id) \ .filter(self.model.year == year) \ .all()
def all(self, is_lokpri=True, is_siskeudes_code=False, page_sort_params=None): query = self.db.session.query(self.model) if (is_lokpri): query = query.filter(self.model.is_lokpri == True) if (is_siskeudes_code): query = query.filter(self.model.siskeudes_code.isnot(None)) query = QueryHelper.build_page_sort_query(query, self.model, page_sort_params) return query.all()
def all_by_year(self, year, is_lokpri=True, page_sort_params=None): query = self.db.session.query(self.model) if is_lokpri: region = aliased(Region) query = query.outerjoin(region, self.model.region) query = query.filter(region.is_lokpri == True) query = query.filter(self.model.year == year) query = QueryHelper.build_page_sort_query(query, self.model, page_sort_params) return query.all()
def all_by_condition(self, has_kode=False, page_sort_params=None): query = self.db.session.query(self.model) query = QueryHelper.build_page_sort_query(query, self.model, page_sort_params) if has_kode: query = query.filter(self.model.kode is not None).filter(func.length(self.model.kode > 0)) return query.all()
def get_by_region(self, region_id, page_sort_params=None): query = self.db.session.query(self.model) query = QueryHelper.build_page_sort_query(query, self.model, page_sort_params) return query.filter(self.model.fk_region_id == region_id).all()
def all_by_year(self, year, page_sort_params=None): query = self.db.session.query(self.model) query = QueryHelper.build_page_sort_query(query, self.model, page_sort_params) return query.filter(self.model.year == year).all()
def all(self, page_sort_params=None): query = self.db.session.query(self.model) query = QueryHelper.build_page_sort_query(query, self.model, page_sort_params) return query.all()
def all_by_condition(self, is_revenue=False, page_sort_params=None): query = self.db.session.query(self.model) query = QueryHelper.build_page_sort_query(query, self.model, page_sort_params) return query.filter(self.model.is_revenue == is_revenue).all()