0
votes

I use ruby client to access data from Cassandra.. Is there any way to get the column names for a given key in a column family. Suppose a column family "test" has 100 rows with rows having different column names. SO given a key how do I get the column names for that key??

1

1 Answers

2
votes

If you are using the 'cassandra' gem then you would do something like this:

@client.get(:my_column_family, key).keys

@client.get returns an ordered hash of column_name => column_value so .keys will give you the column_names.

If you are using the 'cassandra-cql' gem:

@client.execute("select * from my_column_family where key = ?", key).fetch.column_names