"__in" filtering operator converts True to string "True" automatically

Description

I encounter an InvalidRequest exception something like this:
"InvalidRequest: Error from server: code=2200 [Invalid query] message="Invalid STRING constant (True) for "<boolean_field_name>" of type boolean"

From using <Model>.objects.filter(<boolean_field_name>__in=[True, False])

I tried to same query using cqlsh and had no problems, except only if I used 'True' and 'False' for querying.

Thus, I suspect that the filter in cassandra.cqlengine.query has the query parameters translated into string for me which is wrong.

Environment

OSX 10.11.5
Cassandra 3.5
Cassandra-driver 3.5.0
Python 3.4.2

Pull Requests

None

Activity

Show:
Adam Holmberg
July 1, 2016, 1:01 AM

Can you share your model definition? I tried an example here and it worked as expected:

Konpat Preechakul
July 1, 2016, 1:48 AM
Edited

I reproduced the error using this code, note that the boolean is a partition key:

I'm sorry I forgot to mention the '__in' filter operator in the earlier code.

Adam Holmberg
July 1, 2016, 1:57 AM

Thanks for the clarification. I see the issue with the updated example.

Greg Bestland
July 19, 2016, 4:00 AM

Tweaked the tests a little bit here.

https://github.com/datastax/python-driver/commit/f1acf62fb44e2c0ad55a0b2d59dc48acf3cc0b94

LGTM moving this to done.

Fixed

Assignee

Unassigned

Reporter

Konpat Preechakul

Fix versions

Labels

Reproduced in

None

PM Priority

None

External issue ID

None

Doc Impact

None

Reviewer

None

Size

None

Pull Request

None

Sprint

Py P-NEXT

Affects versions

Priority

Major