Reputation: 5890
Intro I'm using the python cql library library to access a Cassandra 1.2 database (CQL 3.0). My table contains a boolean column as follows:
CREATE TABLE test (
id text,
value boolean,
PRIMARY KEY (id)
);
The problem When I try to execute a query like this one using the cql library:
UPDATE test set value=True where id = 'someid'
And using this code:
import cql
...
cql_statement = "UPDATE test set value=:value where id = :id"
rename_dict = {'id':'someid',
'value': True}
cursor.execute(cql_statement, rename_dict)
I'm getting this error:
Bad Request: Invalid STRING constant (True) for value of type boolean
Seems like the cql library is trying to execute this:
UPDATE test set value='True' where id = 'someid'
Instead of this:
UPDATE test set value=True where id = 'someid'
The question
Is there any workaround for this or better way/library to use? (I'm using Cassandra 1.2 with CQL 3.0 CFs, so pycassa is not an option)
Thanks in advance!
Upvotes: 3
Views: 1505
Reputation: 1292
Boolean quoting has been fixed in the upstream since this question was asked, though Debian packages are not updated yet.
Thus solution is to install the library from source.
Upvotes: 3