cqlengine: Remove default limit on QuerySets

Description

There is no mention of the limit method on QuerySet objects in the documentation , so I had to turn to the source code to learn that it's set to 10000 by default. A comment in the source says that 10000 is the default limit in Cassandra queries, but that isn't true. CQLSH imposes such a limit but it's nowhere to be found in the general Cassandra spec.

This limit has caused me tons of problems. I constantly have to hunt for places where someone forgot to add '.limit(0)' to a query and got funky results. It took some source-code diving to determine that '.limit(0)' was the correct way to remove the limit. The code for the limit method suggests that '.limit(None)' is acceptable but Python 3 throws an error at comparison later in the method.

This should probably be multiple issues:

1) Document the limit method on QuerySets
2) Make the limit default to None
3) Fix the limit function so that limit(None) works in Python 3

Environment

None

Pull Requests

None

Activity

Show:
Adam Holmberg
March 14, 2016, 3:06 PM

A comment in the source says that 10000 is the default limit in Cassandra queries, but that isn't true. CQLSH imposes such a limit...

Correct. I think the authors may have been mislead by the cqlsh limit. Will update the comments and docs when updating the default.

1.) docs
2.) Agreed, but this will need to wait for a major rev since it changes default behavior
3.) I think this was addressed in 3.1.0

Done

Assignee

Unassigned

Reporter

Abe Dillon

Fix versions

Labels

PM Priority

C