0

I am using Cassandra database through cqlsh client on Linux. I can make only queries with values given as bytes, but I would like to search with the client like in SQL where everything is Strings.

Should I use assume? Still using it I can only change output, but not queries.

2
  • Please clarify your question with example code of what you're doing. Apr 13, 2012 at 17:26
  • This part is not coding, this is reading the database with a specific database command line tool. Mentioned cqlsh is the client where you can type CQL queries. My problem is that everything on that client is shown as bytes, but I would like to work with higher level types. Maybe this post clarifies this: question about cassandra on SO . Look at the answer of that post, it says that every data in Cassandra is byte[] .
    – mico
    Apr 16, 2012 at 6:37

1 Answer 1

0

I used in my example situation Hector Object Mapping, HOM also for creation of the database from scratch. This was not a good idea, because everything was handled as bytes, like they normally are, and no instructions about how to interpret them was thus given.

Solution to this was to use cqlsh client and give there CQL queries to add tables. So, I made queries like:

CREATE COLUMNFAMILY users (KEY varchar PRIMARY KEY, password varchar);

and with these the remarkable thing is the explicit type (varchar for password) that was given to each column. Now, on the very same tool, data was interpreted as I wanted.

See also:

More info in Getting started with CQL page.

Also see CQL Language Reference for more information e.g. about available datatypes other than varchar mentioned before.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.