Limits the number of results returned by Cassandra. Use *0* or *None* to disable. *Note that CQL's default limit is 10,000, so all queries without a limit set explicitly will have an implicit limit of 10,000* .. code-block:: python # Fetch 100 users
(self, v)
| 883 | return clone |
| 884 | |
| 885 | def limit(self, v): |
| 886 | """ |
| 887 | Limits the number of results returned by Cassandra. Use *0* or *None* to disable. |
| 888 | |
| 889 | *Note that CQL's default limit is 10,000, so all queries without a limit set explicitly will have an implicit limit of 10,000* |
| 890 | |
| 891 | .. code-block:: python |
| 892 | |
| 893 | # Fetch 100 users |
| 894 | for user in User.objects().limit(100): |
| 895 | print(user) |
| 896 | |
| 897 | # Fetch all users |
| 898 | for user in User.objects().limit(None): |
| 899 | print(user) |
| 900 | """ |
| 901 | |
| 902 | if v is None: |
| 903 | v = 0 |
| 904 | |
| 905 | if not isinstance(v, int): |
| 906 | raise TypeError |
| 907 | if v == self._limit: |
| 908 | return self |
| 909 | |
| 910 | if v < 0: |
| 911 | raise QueryException("Negative limit is not allowed") |
| 912 | |
| 913 | clone = copy.deepcopy(self) |
| 914 | clone._limit = v |
| 915 | return clone |
| 916 | |
| 917 | def fetch_size(self, v): |
| 918 | """ |