chrisTina
chrisTina

Reputation: 2368

Show all rows and as specific row in Cassandra's column family

For some reason, I can only use 'cassandra-cli' to do some CQL operations. This is the version I use:

Welcome to Cassandra CLI version 1.1.10

And the Cassandra version I use is:

apache-cassandra-1.1.10

I create a keyspace called 'goldenbuck' and a column family called 'holytest' inside that keyspace. Then I insert a row in it using Hector API.

But back to 'cassandra-cli' to check the content of that column family, such output from 'cli' occurs:

[default@goldenbuck] SELECT * FROM holytest;
Syntax error at position 7: unexpected "*" for `SELECT * FROM holytest;`.

I am pretty sure 'holytest' is there in the 'goldenbuck' keyspace. So what's wrong? How can I get all rows in the 'holytest' and a specific row?

Upvotes: 1

Views: 318

Answers (1)

Lyuben Todorov
Lyuben Todorov

Reputation: 14153

You're using the CLI which is a thrift based tool for interfacing with cassandra. You cant run CQL queries within cassandra-cli. You want to use cqlsh instead of the cli, cql queries are meant to be executed in the cqlsh shell.

Alternatively, if you do want to use the cli, have a read through the apache wiki page on the CLI to get started with it.

On a side note...
My advice, move to a newer version of cassandra. At-least, 1.2 but preferably 2.1, where CQL was getting enough attention and effort making it quite a feature reach querying lang. If you have to use cassandra 1.1 as per requirements, the I'd stick with using thrift purely from a performance and feature standpoint (cql wasn't as advanced in 1.1 as it is now, and much of the documentation might lead to confusion about what you can and can't do).

Upvotes: 2

Related Questions