def one(self, value, field=None): if not field: field = self.model.identify_primary_key() self.filters.update({field: value}) query = self.create_query(self.columns(self.queryargs.exclusions)) buffer = QueryBuffer(query, self.model, vflag=False, queryargs=self.queryargs) return buffer.filter_by(self.filters).first()
def query(self, noauto=False): query = self.create_query() buffer = QueryBuffer(query, self.model, queryargs=self.queryargs) if noauto: return buffer buffer.autoquery() return buffer
def _get(self, flagged=False): query = self.create_query(self.columns(self.queryargs.exclusions)) self._schema = query.column_descriptions # includes # excludes # relationships buffer = QueryBuffer(query, self.model, queryargs=self.queryargs) return buffer.all()
def iquery(self): query = self.create_query() self._schema = query.column_descriptions return QueryBuffer(query, self.model).query
def get_one_by(self, field, value, flagged=False): pkfilter = {field: value} query = self.create_query(self.columns(self.queryargs.exclusions)) self._schema = query.column_descriptions buffer = QueryBuffer(query, self.model, vflag=flagged, queryargs=self.queryargs) return buffer.filter_by(pkfilter).first()
def get_one(self, value, flagged=False): self.filters.update({self.model.id: value}) query = self.create_query(self.columns(self.queryargs.exclusions)) self._schema = query.column_descriptions buffer = QueryBuffer(query, self.model, vflag=flagged, queryargs=self.queryargs) return buffer.filter_by(self.filters).first()