MCPcopy
hub / github.com/ormar-orm/ormar / build_select_expression

Method build_select_expression

ormar/queryset/queryset.py:266–298  ·  view source on GitHub ↗

Constructs the actual database query used in the QuerySet. If any of the params is not passed the QuerySet own value is used. :param limit: number to limit the query :type limit: int :param offset: number to offset by :type offset: int :param

(
        self,
        limit: Optional[int] = None,
        offset: Optional[int] = None,
        order_bys: Optional[list] = None,
    )

Source from the content-addressed store, hash-verified

264 return self.model_config.table
265
266 def build_select_expression(
267 self,
268 limit: Optional[int] = None,
269 offset: Optional[int] = None,
270 order_bys: Optional[list] = None,
271 ) -> sqlalchemy.sql.Select:
272 """
273 Constructs the actual database query used in the QuerySet.
274 If any of the params is not passed the QuerySet own value is used.
275
276 :param limit: number to limit the query
277 :type limit: int
278 :param offset: number to offset by
279 :type offset: int
280 :param order_bys: list of order-by fields names
281 :type order_bys: list
282 :return: built sqlalchemy select expression
283 :rtype: sqlalchemy.sql.selectable.Select
284 """
285 qry = Query(
286 model_cls=self.model,
287 select_related=self._select_related,
288 filter_clauses=self.filter_clauses,
289 exclude_clauses=self.exclude_clauses,
290 offset=offset or self.query_offset,
291 excludable=self._excludable,
292 order_bys=order_bys or self.order_bys,
293 limit_raw_sql=self.limit_sql_raw,
294 limit_count=limit if limit is not None else self.limit_count,
295 )
296 exp = qry.build_select_expression()
297 # print("\n", exp.compile(compile_kwargs={"literal_binds": True}))
298 return exp
299
300 def filter( # noqa: A003
301 self, *args: Any, _exclude: bool = False, **kwargs: Any

Callers 10

existsMethod · 0.95
countMethod · 0.95
_query_aggr_functionMethod · 0.95
_fetch_singleMethod · 0.95
getMethod · 0.95
allMethod · 0.95
iterateMethod · 0.95
has_cartesian_productFunction · 0.45
valuesMethod · 0.45

Calls 2

QueryClass · 0.90