0
votes

I use hector to manipulate cassandra of version 2.1.8 and want to retrieve all the tables from certain keyspace in an application. I use "KeyspaceDefinition.getCfDefs()" to retrieve the columnfamily list in a keyspace.

However, I found that the getCfDefs() function can just retrieve the columnfamily created by the thrift api such as "me.prettyprint.hector.api.Cluster.updateColumnFamily" but not table created by CQL such as cqlsh client.

Then, how to retrieve all the tables from certain keyspace by using hector?

1
@BryceAtNetwork23 I am trying to do it by using Hector. However, I may use CQL rather than hector in future.chenatu

1 Answers

2
votes

You can inspect all table metadata for a keyspace programmatically using the system metadata tables:

select * from system.schema_columnfamilies where keyspace_name='ks';
select * from system.schema_columns where keyspace_name='ks';

You would need to aggregate these columns and tables yourself.

Alternatively, if you're not tied to this client, you can use cqlsh to "describe" the keyspace in question, or use one of the DataStax drivers with a metadata API (java, python).