Search code examples
javacassandrahector

How to list all column names in a column family in Cassandra?


I'm using Cassandra, and I want to make a data browser which shows the contents of any column family. I need to get the column names to configure a UI grid. Is it possible to collect the names of columns in all rows?


Solution

  • The best way, if you are using Cassandra 1.1:

    SELECT column_name FROM system.schema_columnfamilies WHERE keyspace_name = X AND columnfamily_name = Y
    

    See also http://www.datastax.com/dev/blog/schema-in-cassandra-1-1