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

Method limit

ormar/queryset/queryset.py:960–977  ·  view source on GitHub ↗

You can limit the results to desired number of parent models. To limit the actual number of database query rows instead of number of main models use the `limit_raw_sql` parameter flag, and set it to `True`. :param limit_raw_sql: flag if raw sql should be limited

(
        self, limit_count: int, limit_raw_sql: Optional[bool] = None
    )

Source from the content-addressed store, hash-verified

958 return self.rebuild_self(limit_count=limit_count, offset=query_offset)
959
960 def limit(
961 self, limit_count: int, limit_raw_sql: Optional[bool] = None
962 ) -> "QuerySet[T]":
963 """
964 You can limit the results to desired number of parent models.
965
966 To limit the actual number of database query rows instead of number of main
967 models use the `limit_raw_sql` parameter flag, and set it to `True`.
968
969 :param limit_raw_sql: flag if raw sql should be limited
970 :type limit_raw_sql: bool
971 :param limit_count: number of models to limit
972 :type limit_count: int
973 :return: QuerySet
974 :rtype: QuerySet
975 """
976 limit_raw_sql = self.limit_sql_raw if limit_raw_sql is None else limit_raw_sql
977 return self.rebuild_self(limit_count=limit_count, limit_raw_sql=limit_raw_sql)
978
979 def offset(
980 self, offset: int, limit_raw_sql: Optional[bool] = None

Callers 15

test_limit_zeroFunction · 0.45
test_or_filtersFunction · 0.45
test_gettingFunction · 0.45
test_queryset_methodsFunction · 0.45
test_model_limitFunction · 0.45
test_offsetFunction · 0.45
test_selecting_relatedFunction · 0.45
test_selecting_relatedFunction · 0.45

Calls 1

rebuild_selfMethod · 0.95

Tested by 15

test_limit_zeroFunction · 0.36
test_or_filtersFunction · 0.36
test_gettingFunction · 0.36
test_queryset_methodsFunction · 0.36
test_model_limitFunction · 0.36
test_offsetFunction · 0.36
test_selecting_relatedFunction · 0.36
test_selecting_relatedFunction · 0.36