Get a random string in Cassandra using Datastax and CQL

I am NoSQL n00b and just trying to figure it out. I have the following single table keyspace in cassandra 2.0.2

CREATE KEYSPACE PersonDB WITH replication = {
'class': 'SimpleStrategy',
'replication_factor': '1'
 };

USE PersonDB;

CREATE TABLE Persons (
 id int,
 lastname text,
 firstname text,
 PRIMARY KEY (id)
)

I have about 500 entries in the Faces table. I want to select any random row from a table. Is there an efficient way to do this in CQL? I am using groovy to call APIs open with datastax.

+4
source share
1 answer

If you want to get "any" string, you can just use LIMIT.

select * from persons LIMIT 1;

You will get a line with the bottom hash of the section key (id).

, , .

+1

All Articles